LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read from spreadsheet

I am using Labview to run a test procedure. At the beginning of the program,
I would like to compare the model number of the product being tested against
a model number in an excel spreadsheet. How do I use the "Read from Spreadsheet"
VI to get the info. Which output terminal do I use? Do I have to do something
to the output before I can use the Match VIs?
0 Kudos
Message 1 of 2
(2,015 Views)
Stan,

The "Read from Spreadsheet VI" VI is not going to work for you with your current
setup, but there are some alternatives I will suggest.

The problem is that the Spreadsheet VIs in LabVIEW are really only referring to a
generic spreadsheet file format, not an Excel binary format. A generic spreadsheet
file is a simple textfile with several lines of data (rows) delimited by the
operating system's end of line character. Each row has a number of string values
(columns) that are often delimited by a tab. This is the sort of thing that the
built-in LabVIEW VIs are designed to read, and Excel allows you to save your
spreadsheet as a textfile in this format if you want. You'd then have to select the
appropriate row and column using the LabVIEW array functions in order
to get the
model number info to compare.

Another option is to leave your Excel sheet as it stands and use Excel's ActiveX API
to read selected cell values directly from the Excel binary file that you have.
Here's a good example of that in the NI Example Programs Database:

http://digital.ni.com/explprog.nsf/websearch/83bcdadcf22cd5b586256616007d6069

The drawback here is that it's Windows-specific, and you have to change the code if
you migrate between various versions of Excel.

Good luck,
John Lum
National Instruments

Stan Oliver wrote:

> I am using Labview to run a test procedure. At the beginning of the program,
> I would like to compare the model number of the product being tested against
> a model number in an excel spreadsheet. How do I use the "Read from Spreadsheet"
> VI to get the info. Which output terminal do I use? Do I have to do something
> to the output before I can use the Match VIs?
0 Kudos
Message 2 of 2
(2,015 Views)