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.
- 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.
- In LabVIEW, bring up the Functions Palette and select File I/O » Read Delimited Spreadsheet.vi
- 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).
- 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.
In LabVIEW 2014 SP1 and earlier, this functionality was encapsulated in the Read From Spreadsheet VI, which has been deprecated as of LabVIEW 2015.