11-03-2009 02:12 PM
Hi
I need help in finding the row number in excel.
Actually what i am trying to do is, i am using the scanner to read the barcode(string) then i need to search for the same string in the excel file(my datas are saved as like this for ex:In row 5, in column 1 i have the string(West) from column 2 to column 10 i will have some values). Now when my string matches with West its going to display the values from column 2 to 10, so i have to find at which row number the string West matched.
Thanks
Solved! Go to Solution.
11-03-2009 03:10 PM
I haven't worked this out, but would approach it this way.
Read the file from spreadsheet as text...it is then a 2D array of text. In a for loop, index through the array until the first column = the text word you are searching for (West). The i value will be the correct index to the rest of the data on that row,
Use the i to index the array again and now convert all the columns to numbers from text...
That's what I would try to do...
Ben showed this to someone on the forum in the last few days and I will see if I can find a reference to that.
11-04-2009 04:08 AM
Thanks Hummer
The problem is we have values saved in excel so i ahve to read from excel,
11-04-2009 08:38 AM
11-04-2009 09:15 AM
11-04-2009 12:09 PM
Thanks All
I have tried the above suggestions, it works fine for .txt files but i am getting some erroe when it is .xls file
Thanks
11-04-2009 12:20 PM
Go back and read through the Excel board again.
You are making what is a very common mistake since the Read from Spreadsheet File is a poorly named, confusing function. It only reads text files that are structured in a spreadsheet like format. It does not read .xls files which are a proprietary Microsoft format for the Excel spreadsheet program. If you think about it, an .xls file has to store far more information than just the values stored in the cells. It has to store formating and formula information. It has multiple sheets. It holds visual basic code. ..... A simple Read from Spreadsheet file function doesn't know how to sort through all that information.
As Dennis said, you need to use ActiveX functions.
11-04-2009 12:35 PM
Thanks Ravens
Its working now.Thanks All
11-04-2009 12:50 PM
Searching through the forums helps a lot. Here is a discussion where I already solved your problem.
http://forums.ni.com/ni/board/message?board.id=170&message.id=200494&jump=true
For more information and some sample VI's and tool kits, you can go to the excel board