From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
02-14-2010 06:57 PM
Hi,
I have 2 problems using read from spreadsheet file :
1) when using .txt file I can only get the first column and not the second one (although I have chosen the correct output...)
2) It doesn't work at all when using my .xls file
I must be doing something wrong but can't find what....
Would anybody have an idea ?
I have attached the .VI and my two files.
Thanks
User
Solved! Go to Solution.
02-14-2010 07:45 PM - edited 02-14-2010 07:46 PM
In your "Read From Spreadsheet File", you have your delimiter set to "\s", meaning that the VI expects the delimiter between numbers to be a space.
Have you actually looked at the formatting of your text file? Evidently not. The delimiter in your text file is a tab...not a space.
Delete the "\s" input to the VI (a tab delimiter is the default delimiter for "Read From Spreadsheet File") and it'll work fine. I just did it, and sure enough, it works fine.
The reason that "Read From Spreadsheet" cannot read your .xls file is because a file created with Excel (that is, an .xls file) is a custom Microsoft format, and not a standard text file. In order to read an .xls file directly, you'll have to use ActiveX.
Hope that helps.
d
02-14-2010 07:52 PM
It is a bit more to it than that.
I saw the tab vs. space delimiter problem. I changed it to \t for a tab delimiter, but it still didn't work.
The reason? The OP has the constant showing \t in Normal display which is a delimiter of backslash t. It needs to show \t in \codes display to actually represent a tab.
02-14-2010 09:45 PM
Yes. Good catch. Thanks!
The OP could also wire in a tab constant from the strings palette...I did that just for fun and that also works.
03-11-2010 04:07 AM
Hi Diane and Ravens fan,
Thanks for your answers.
I have attached the VI that works fine with the .xls that is created and saved to with Labview when acquiring my data.
I don't need this for my program but I would like to understand why is this : when creating a file with Excel it only works when the file is saved in .txt but not when saved as a excel file....
User
03-11-2010 04:52 AM
03-11-2010 11:55 AM
A native Excel file is NOT a text file. It's a custom file format created by Microsoft. That is why you have to use ActiveX to interact with it.
The "Spreadsheet" file functions found in LabVIEW work with text files (tab-delimited, CSV, etc.). Text files are a more generic format which can be read by programs like Notepad. Ever tried to use Notepad to open a .xls file? It doesn't work. Excel can open a text file because it's a generic format.
So, even though everyone automatically thinks "Excel" when they see the word "Spreadsheet", the two are not synonymous. In LabVIEW's case, "Spreadsheet" refers to a delimited text file.
Does that make sense?