07-09-2009 02:43 PM - edited 07-09-2009 02:46 PM
Dear all,
I have a problem reading the excel (xls) file with the first row containing strings of various of length.
I wonder how I can ignore the first line and continue reading from the second line.
Thank you very much.
Solved! Go to Solution.
07-09-2009 02:58 PM
How are you reading the .xls file now? Are you using ActiveX methods? If so, just define the range you want to read as beginning at row 2.
07-09-2009 03:02 PM
07-09-2009 03:09 PM - edited 07-09-2009 03:10 PM
Then you are not reading an Excel file. An excel file is a binary file with a proprietary format. You actually have a text file that you happened to give an .xls extension to. And that is a bad idea because .xls implies you have an Excel file.
As mentioned numerous times in the forums, the Write to (Read from) Spreadsheet file functions are poorly named. When people think spreadsheet, they think Excel. But these functions don't handle Excel files. They work on text files that saved in a spreadsheet like format (tab delimited, end of line characters).
You will need to open the text file and read 1 line. Then read the rest of your data. Convert the string to an array.
There may be other ways of doing this. Search the forums as questions about Read from Spreadsheet file have been asked thousands of times before.
07-09-2009 03:42 PM
Ravens Fan wrote:
Search the forums as questions about Read from Spreadsheet file have been asked thousands of times before.
But who's counting?
To question: If it's just the first row that's the problem, you can also just use an Array Subset after reading it to get rid of the first row.
07-09-2009 04:36 PM
Ravens, could you kindly label your diagram of each block? I could not find the same block(function) from my Labview. My version is Labview 8.5 Full develop system.
Thanks.
07-09-2009 06:20 PM
I don't have that VI saved.
So here are the names.
Across the bottom: Open File. Read Text file with Read Lines selected (right click for menu to find it). Read Text File with Read Lines not selected. Close File. At the top is Spreadsheet String to Array.
07-09-2009 09:18 PM