10-06-2015 03:54 AM
The "read from spreadsheet" vi from the file i/o palette does not return an error cluster.
It just returns an empty path if one used the feature of opening a file dialog on unwired path input and the user pressed cancel.
It also returns eol if read past end of file.
What i would like to get is the possibility to catch any file i/o error after calling the said function.
Up to now i test for file existance before calling "read spreadsheet" and check on empty path return value.
What else could i do except testing for eol, too.
Is there a vi which returns me any file i/o error?
10-06-2015 04:31 AM
Hi Labuser,
ReadFromSpreadsheet is kind of an ExpressVI: it was created long time ago to simplify reading spreadsheets.
You can open the BD and see how it works.
With that knowledge you can create your own version of "ReadFromSpreadsheet with errorIO" quite easily!
10-06-2015 05:39 AM
Thank you!
Instead of using "read from spreadsheet" directly (which seems to be deprecated after what you said)
i use now "read from textfile" and "convert table string to array" which enables catching common i/o errors after reading the file.
10-06-2015 06:11 AM
Hi Labuser,
no, it's not deprecated. It has been renamed for the latest LabVIEW version! 😉
Using ReadFromText and SpreadsheetStringToArray is basically the same as is done inside of ReadSpreadsheetFile - as you notice when opening its BD…
10-06-2015 06:51 AM
Yes, but that old "read lines from file" vi inside does not return an error cluster and only the eof state which is passed through the return val of
"read from spreadsheet".
Contrary the "read textfile" (which seems to be backend as a block diagram cannot be opened) return an error cluster with error description and error code which is more compatible to todays labview error handling and is an essential difference.
However i agree that from algorithm perspective "read from spreadsheet" is basically the same as using "ReadFromText" and "SpreadsheetStringToArray".