Example Code

Read Data from Spreadsheet (.csv) and Display in LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW Report Generation Toolkit
  • LabVIEW

Code and Documents

Attachment

Overview

This example will read a .csv file and display it in an array indicator.

 

 

Description

This example shows how you can use the Read from Spreadsheet VI to pull data from a spreadsheet. In order to directly read Microsoft Excel files we need to use the Report Generation Toolkit (examples in Help»Find Examples), but in Excel you can save a spreadsheet as a Comma Separated Value file (CSV) and you can read that using the Read from Spreadsheet VI.

 

While this example will not necessarily work for all formats of spreadsheets, it demonstrates the usage of the delimiter and should be a good starting point to build an application.

 

To Write to a CSV Spreadsheet file check out this example: Getting Started: Write Continuous Data to Spreadsheet (CSV) with Headers

 

 

Requirements

LabVIEW 2012 (or compatible)

 

 

Steps to Implement or Execute Code

  1. First save your spreadsheet as a csv file Click here for help doing this in Microsoft Excel. Or use the csv File in the Zipped Folder
  2. Unzip the attached folder "Read From Spreadsheet_LV2012_NI Verified.zip" to your computer and Open the Read from Spreadsheet VI

  3. Set the path to your csv file

  4. Set the My File has Row Headers switch to on

  5. Run the VI

 

Additional Information or References

Front Panel

Front Panel.PNG

 

Block Diagram

 

BD.PNG 

 

 

 

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
streetpoet
Member
Member
on

really helpful.

juanitoing84
Member
Member
on

¿Where is MyData.csv?

Horus91
Member
Member
on

thanks you

syrpimp
Member
Member
on

Create a dummy file with extension name .csv to evaluate this program



Thank you & Best regards
syrpimp

=======================================================
“You must continue to gain expertise, but avoid thinking like an expert." -Denis Waitley
Corelab
Member
Member
on

How do you get it to read both characters and numbers from all the rows. Each row has columns mixed with both characters and numbers and this just takes the number out to display besides the first row.

dilaekayati
Member
Member
on

How to get an fft from csv file ? I have vibration sensor data in csv from excel file. The 1st column is time data, the 2nd column is the data itself. This is my email dilaekayati@gmail.com . I've tried many fft function , but none of them show the fft  i really want.my fft project.jpg

dilaekayati
Member
Member
on

here is the front panel result when i run the block diagram :

my fft project fp.jpg

Meins321
Member
Member
on

can you upload your version somewhere? thank you!

abouMouadh
Member
Member
on

thank you for this helpfull exemple it's a very good explanationSmiley LOL