LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading from Excel

Hi

 

I currently have an Excel file with two columns and 93 rows containing only numbers. I would like to perform a loop in Labview 6.1 that reads row1's 2 values and feed them into a command string for use with a GPIB cable. This would repeat another 92 times for the other rows. I have a working establishment with my GPIB device inside a loop but have had no success with the excel reading. All I really need is:

1) A vi file that opens an excel file once

2) Once opened, it extracts both the values situated in A1 and B1 whilst in a loop structure.

3) These values are then sent into a command string with two separate commands

4) The row is incremented if <93

5) The loop repeats until row 93 is reached

6) The excel file closes

7) Program finishes

 

I hope this is fairly clear and any help is much appreciated!

 

0 Kudos
Message 1 of 21
(3,905 Views)

Hi ms1,

see this link please.

 

Mike

0 Kudos
Message 2 of 21
(3,884 Views)

See here.

 

But, Mike bet me here... Smiley Mad

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 3 of 21
(3,879 Views)

Thanks for the info,

 

I've reached a bit of a roadblock in the attached file. I was using it to access a simple excel file with 2 columns and the data in the table comes back with 10 columns with the data in the table mismatching the data in my file. The range was set to cell 1 being A1:A93 and cell two to B2:B93. The property node that has the application property has a property entitled visible which, when true, shows the file being opened and closed so I am certain that the correct file is being read. Can you please give me some assistance?

0 Kudos
Message 4 of 21
(3,832 Views)

Hi,

 

I've been out of office for a few days! Any help will be appreciated

0 Kudos
Message 5 of 21
(3,793 Views)

Hi

 

From the two attached files it can be seen that the read data is incongruent with the excel file even though the vi does indeed open test.xls. I don't know why this is such a problem as it is a very simple excel file. I have little knowledge of LV so I really do need assistance. I am working with LabVIEW 6.1 so please post any responses with this version in mind.

 

Thanks

Download All
0 Kudos
Message 6 of 21
(3,785 Views)
The problem is with your Variant to Data use. You are wiring the same array constant to both the "variant" input and the "type" input. This will obviously give you the array constant back since you are not converting anything. The "variant" input should receive the variant data from the "Value" property node. The "type" input should be wired to an empty 2D array constant. The datatype of the 2D array constant will dictate what you get. In your case you want a 2D array constant of numbers (probably integers based on your Excel file), not strings.
0 Kudos
Message 7 of 21
(3,774 Views)

Thanks Smercurio...

 

 I have tried what you suggested but same values are popping up in my table as previously encountered.

Download All
0 Kudos
Message 8 of 21
(3,756 Views)

I indicated that you should be wiring an empty array, not one that already has numbers in it.

 

Please upload your latest VI.

0 Kudos
Message 9 of 21
(3,731 Views)

Here is the file... Thanks

0 Kudos
Message 10 of 21
(3,696 Views)