Import CSV Spreadsheet Files into LabVIEW

Updated May 3, 2018

Reported In

Software

  • LabVIEW Base
  • LabVIEW Full
  • LabVIEW Professional

Other

  • Microsoft Office
  • Microsoft Excel

Issue Details

I have a Microsoft Excel spreadsheet that I would like to import into LabVIEW, but I do not want to use ActiveX calls to read the data. Is there another way to read in this type of file?

Solution

One way to read an Excel spreadsheet into LabVIEW is by saving it as a .csv file, which is a feature built into Excel. To save a spreadsheet in Excel as a .csv and import it into LabVIEW, follow the below steps:

1. In Excel, select Save As and in
  • Microsoft Office 2010 and older: Select Other Formats (shown below)
  • Microsoft Office 2013: select a location to save.
 
  1. In the Save As type drop down menu, select CSV (Comma delimited)(*.csv).
\
Note: Two caveats--using the .csv file format does not support multiple sheets, and some other Excel features may not be compatible. Excel will display two warnings about these limitations when you save the file.
 
  1. In LabVIEW, bring up the Functions Palette and select File I/O » Read Delimited Spreadsheet.vi 
  1. Right-click on the delimiter (\t) input located on the bottom edge of the VI and select Create » Constant. The default value for this input is a single tab character (\t).
    1.  For a comma-separated value file, change the newly created string constant to a comma. 

By default, the VI will display a File Dialog box to locate the .csv file at run-time. Additionally, you can display the data in multiple ways. The above example displays all of the rows read from Excel.

Additional Information


Note: The Read Delimited Spreadsheet sub-VI contains a significant amount of functionality. Refer to the Context Help for more information about the various inputs and outputs.

To use the Excel file (instead of a CSV file) directly in LabVIEW, the Report Generation Toolkit is required. As of LabVIEW 2014, this toolkit is now included with LabVIEW Professional. Please see the product page for more information: NI LabVIEW Report Generation Toolkit for Microsoft Office

In LabVIEW 2014 SP1 and earlier, this functionality was encapsulated in the Read From Spreadsheet VI, which has been deprecated as of LabVIEW 2015. 
 

WAS THIS ARTICLE HELPFUL?

Not Helpful