LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Keeping track of CSV formatting

Ok,

 

I am having issue with keeping the formatting of CSV files. Traditionally, I have uses TXT file formats to keep track of everything from data to calibration curves. I use tab delimiter in over 10 or so years of doing this I have never had any issues.

 

Fast forward to now, I was in a bind and out sourced some work to a contractor. Even though I gave them a specific style guide, they did a lot of things their own way i.e. CSV vs TXT. Since the project was much more than just LabVIEW code I couldn't really reject the work.

 

The problem is that customers are opening the CSV files in numerous programs (Notepad, Wordpad, Excel, OpenOffice, etc.). I am finding that some programs insert quotes around row data. By example a specfic row should look like this:

 

pH Slope,10

pH Intercept,-15

 

Instead it look like this:

 

"pH Slope,10"

"pH Intercept,-15"

 

When I search the file for pH Slope I don't find it.


In addition to that, sometimes additional rows are added all together and look like this:

 

"pH Slope,10"

,

"pH Intercept,-15"

 

I will use a Search and Replace subVI to remove all the " and remove them. But what is the best way to elimate this type of things from happening all together?

Doug Ferguson

www.southerndaqsolutions.com
0 Kudos
Message 1 of 4
(2,552 Views)

The best way is to reject the work and tell them to give you what they were contracted to give you. Excel will take liberties with a file that has a CSV extension. Writing a VI to remove the quotes is kludgy but it will work as long as you never expect quotes to be contained in valid data.

=====================
LabVIEW 2012


0 Kudos
Message 2 of 4
(2,537 Views)

Based on what you are describing, I expect your customers are opening the files in a spreadsheet program, but are not using a comma as a delimiter.  So, if they re-save the file, the spreadhseet is putting quotes around the text blocks.

 

At this point, as you said, you will probably need to remove the quotes and blank lines (that I have no insight on).

 

If your customer are modifying/saving these files, either tell them to import them correctly, or not to use anything but a text editor.

0 Kudos
Message 3 of 4
(2,533 Views)
Also, if the customer is willing to only open the files in Excel, you might look into TDMS. I realize that the project is done and I only suggest this for future projects. TDMS is greatly overlooked by many people including myself.
=====================
LabVIEW 2012


0 Kudos
Message 4 of 4
(2,497 Views)