LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read from spreadsheet, getting file i/o error after

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?

 

0 Kudos
Message 1 of 5
(2,962 Views)

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!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(2,948 Views)

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.

 

0 Kudos
Message 3 of 5
(2,929 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(2,918 Views)

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".

 

0 Kudos
Message 5 of 5
(2,901 Views)