LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Old LabView reading Excel

I am using an 15 yo Labview GUI interface the displays a time series from a csv file, and has sliders to denote start and stop points to process data that is contained between the slider points. 8 Columns are: Date Time CH4 C2H2 Wind_direction Wind_Speed Lat Lon. In columns separated by spaces. This old LabView runtime code was designed to read an to read Excel files.  However now these csv files are generated from a Python script. In order to read the csv files they need to be opened in Excel and resaved.  Will the Labview program read the csv if it is installed without the add on? Or do I need to use Python to build a file to emulate an Excel csv file. If its the latter what are those modifications?  

0 Kudos
Message 1 of 6
(522 Views)

Hi da,

 

a CSV file is just a text file with a certain formatting. as long as you don't change the formatting it doesn't matter which tool is used to create the CSV file!

 

LabVIEW can read text files without any toolkit.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(501 Views)

So right understood an CVS files saved from excel, the LabVIEW program can use, but CVS files saved from Phyton the LabVIEW program can't read?

 

CVS is text files, so I will suggest you to open one of each files in a text editor and see what is the difference. You can eventually post a section from both files. 

 

If you have the source code (block diagram) for your LabVIEW, it will probably be quite easy to change it to read the new Phyton format. 

Anders Pedersen Sekanina
sekanina.dk




0 Kudos
Message 3 of 6
(484 Views)

A CSV file contains "Comma-Separated Values".  This means it has values, as text, with columns separated by commas, and rows separated by line-terminators (often <CR><LF>).  Microsoft decided to "brand" these files with an icon that "looks like Excel" (just to confuse us, I think), but as has been said already, CSV files are just text files.

 

In recent versions of LabVIEW, the first two functions on the Files I/O Palette are "Write Delimited Spreadsheet.vi" and "Read Delimited Spreadsheet.vi", which are made for CSV (a "comma-delimited") file.  This function, by default, uses a <tab> as a delimiter (which makes such a file, when printed, "line up nicely", something that Microsoft also supports), but you can easily change the delimiter on this VI (it's an input on the bottom) to a comma, and now your CSV file will read very nicely.  Remember that everything is text -- if you have numbers, you might want to use some of the String functions to turn text numeric data into numbers (for example, if the file is all numbers, you can use Spreadsheet String to Array.

 

Bob Schor

0 Kudos
Message 4 of 6
(445 Views)

@Bob_Schor wrote:

A CSV file contains "Comma-Separated Values".  This means it has values, as text, with columns separated by commas, and rows separated by line-terminators (often <CR><LF>).  Microsoft decided to "brand" these files with an icon that "looks like Excel" (just to confuse us, I think), but as has been said already, CSV files are just text files.


They open automatically in Excel and are in that way "Excel files", just like you can link .txt to Word.

 

OP, if you compare the resulting files from Python and LV in e.g. Notepad++ you should easily see what's different. I suspect Bob is right on the target with different separators.

Either change the Python code to export in the correct format or you'll have to open it in Excel and use Text to data and/or some text replacement to have it work.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 6
(442 Views)

I apologize for the delay.  I'm one man operation and blah, blah whine. Anyway here is the code that reads only csv files that have been re-saved in Excel.  I do recall having to download and add on for this purpose. At that time I was quite naive and maybe it wasn't necessary. 

 

https://drive.google.com/drive/folders/17SHx06tWXSHezwUGS9XuJKdHv66qfZl3?usp=drive_link

 

it was written by a coder in the EPA so public domain and too large to attach.  If i need to attempt a different way please advise.

 

Thank you.

0 Kudos
Message 6 of 6
(338 Views)