LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Searching a specific value from an excel file(.csv or xls) using labview without activeX

  1. Read the entire spreadsheet into a 2D Array.
  2. Search the Array for the values you are interested in.
  3. That should give you the index of the values you were searching for

BTW: I would index the 2D a row at a time and use "Search 1D Array" to find your values keeping track of the row you are on you will have the 2D index.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 11 of 13
(386 Views)

Hi RTSLVU,

I guess, unless I am missing something, the main problem is labview 8.0 has two ways to read a file, one is the read from spreadsheet and the other is the read a text file. If I read from a spreadsheet, it doesnt read the column tags/names, just reads the values. Buf If I read from a text file, it treats everything as strings. I cant manipulate the data without converting them. In my program, I can only search for a specfic name and should get the value. So if I have a file like

Country name age favNum

      A         x         10    7

      B         y          41    6

I should be able to search for x and age and get 10 in return. But I dont know how to specify what column and row I am looking for. 

I hope I made it clear but if you need anything else, please do not hesitate to ask. I know it would be better with a code snippet or pic but like I mentioned, I am still in the designing process, so I dont have either.

 

Thanks,

Kaawn

 

0 Kudos
Message 12 of 13
(377 Views)

Well you are going to have to work with the data as strings then if you are searching for strings.

 

Search for your string (x)

That gives you the index of the age data

Index the age string out of the String array and convert it to a numeric if you need a numeric data type

 

Honestly unless your spreadsheet is going to change why do you need to search at all?

 

It looks like the age is always the third column...

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 13 of 13
(374 Views)