Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
61 ratings:
 2.81 out of 5   

How Can I Import Spreadsheet Files into LabVIEW Using the CSV Format?

Primary Software:
Primary Software Version: 8.2
Primary Software Fixed Version: N/A
Secondary Software: N/A

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 any other way to read this type of file?

A common method of reading spreadsheet data into LabVIEW is with the Read Delimited Spreadsheet VI.  This VI can read any type of spreadsheet as long as the file delimiter is known.  A delimiter is a sequence of one or more characters used to specify the boundary between cells in the spreadsheet file.  One good example of a delimiter is the comma character, which acts as a field delimiter for a comma-separated value file. 

Microsoft Excel has a built in feature to save a spreadsheet as .csv file type.  This file type saves the raw data in a text file separated by the comma character.  LabVIEW can then read this file type with the Read Delimited Spreadsheet VI and import your data. 

Below is the process for saving a spreadsheet in Excel as a .csv file and importing it into LabVIEW.
  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

  2. In the Save as type drop down menu, select CSV (Comma delimited)(*.csv)

    Note:  Two caveats to using the .csv file format are that it does not support multiple sheets and some Excel features are not compatible.  Excel will display two warnings about these limitations when you save the file. 

  3. In LabVIEW, bring up the Functions Palette and select File I/O»Read Delimited

  4. 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), and since this is a comma-separated value file we need to change it to a comma.  In the string constant that was created, type a comma character (,). 

    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. 
The steps above are necessary to read in your file.  By default, the VI will display a File Dialog box to locate the file at run-time.  Additionally, there are multiple ways to display the data.  The above example displays all of the rows read from Excel.  Refer to the LabVIEW Help for more information about display functionality. 

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: Products and Services: NI LabVIEW Report Generation Toolkit for Microsoft Office

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

Related Links:
KnowledgeBase 4CSI7PQ7: Reading Microsoft Excel Numeric Data Into LabVIEW
Products and Services: NI LabVIEW Report Generation Toolkit for Microsoft Office

Read from CSV SnippetRead from

Report Date: 02/11/2009
Last Updated: 01/04/2016
Document ID: 4UAB2OLF

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit