Reading Microsoft Excel Numeric Data Into LabVIEW

Updated Jan 2, 2018

Reported In

Software

  • LabVIEW Base
  • LabVIEW Full
  • LabVIEW Professional

Operating System

  • Windows

Issue Details

How can I read numeric data from my Microsoft Excel spreadsheet into LabVIEW?

Solution

There are two VIs that help with reading from a Microsoft Excel spreadsheet in LabVIEW:
 
  • Read Delimited Spreadsheet VI
(which replaced the Read From Spreadsheet File VI in LabVIEW 2015 and onward)

If you created your Excel spreadsheet by manually entering the data in (not using LabVIEW and Write Delimited Spreadsheet VI), Read Delimited Spreadsheet VI will not properly interpret your .xls file and will return zeros into your array. In order to get the data into an array in LabVIEW you will have to save the Excel file as a Tab delimited text file. Inputting the new .txt file into the file path node of Read Delimited Spreadsheet VI will populate your array with the proper data.
 
  • Read From Measurement File Express VI
You may read numeric data in an Excel spreadsheet into LabVIEW using the Read From Measurement File Express VI through a the following steps:​
  1. Navigate to the location where you have your Excel document saved as a Tab delimited text file, right-click on your filename.txt document, select Rename, and rename your file with a .lvm extension so that your file now appears as filename.lvm.
  2. Read your numeric spreadsheet data into LabVIEW by specifying filename.lvm as the File Name in the Read From Measurement File Express VI configuration window.

To save your spreadsheet to a tab delimited text file, please follow these steps:
  1. Open your Excel spreadsheet containing simple numeric information.
  2. Save your Excel spreadsheet as a Tab delimited text file.
  1. Click OK.  Note that you are only saving numeric data from the active worksheet.
  2. Click Yes.
  3. Close your Microsoft Excel document. 

 

Additional Information

Read From Spreadsheet File VI (Read Delimited Spreadsheet VI):
If you just need the first column of data, you can wire a True constant to the Transpose? node, and the First Row output will give you an array with the values of your first column of data.

Note:
Microsoft Word and Microsoft Excel are powerful standard software packages for creating reports. Because of their popularity, some LabVIEW users programmed LabVIEW ActiveX applications to dynamically control these document packages for generating reports from LabVIEW. The complexity of the ActiveX interface of those packages, however, makes the development of custom applications difficult. With the LabVIEW Report Generation Toolkit for Microsoft Office, you no longer have to learn the complex object models of Microsoft Word and Excel to generate a report. The Report Generation Toolkit is a library of flexible, easy-to-use VIs for programmatically creating and editing Microsoft Word and Excel reports from LabVIEW.

WAS THIS ARTICLE HELPFUL?

Not Helpful