LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert .XLS to Tab Delimited Text file .txt

I have laboured to find an activex solution to open an Excel .xls file then simply save as Tab Delimited Text file. (which is more digestable for importing as strings into an array)
does anyone have any LV8.2 .vi that will accomplish this or guidance for a newby how to do this simple task.
Regards
Chris
0 Kudos
Message 1 of 4
(5,063 Views)
I may have misundersood the intent, but I have a dumb question: If you're trying to open the file using ActiveX and then resave it as text so you can "more easily" read it into strings, why don't you just read the Excel file directly in the first place? Why the extra step of converting to a text file? (Note: I'm assuming based on the wording of the question that you're trying to do this conversion in LabVIEW, as opposed to having an external tool.)
0 Kudos
Message 2 of 4
(5,048 Views)

The problem is that im a complete stranger to activex and its terminology, although I understand it is the more elegant way of importing cells to an array.

The solution I am seeking is to import all rows, as strings into an array, from a .xls that contains both text and numeric values. I can strip the unwanted text later and perform string to number conversion to obtain the values I require for the rest of my .vi 

If I try to use the "Read From speadsheet" .vi I get gobeldygook, all the worksheet header info and bin data, however if I save the .xls as a Tab Delimited Text file then I can use "read from spreadsheet" which I am familiar with. I understand that .XLS file as bin data cannot be read directly. and that an instance of excel must be opened to perform activex type commands to drive excel functions.

I do not know how to use activex to read directly from an .XLS, I'm assuming its a case of opening the file (from a file dialog select), selecting worksheet, select range to import, import, then close file. Basic examples to play with at this stage would be greatly appreciated.

Regards

0 Kudos
Message 3 of 4
(5,024 Views)
As you noted, the Read from Spreadsheet File is not intended to be used to actually read Excel workbooks. The name of the function has confused many new LabVIEW users. It's intended to be used to read text files that are "spreadsheet-like". It has been suggested that the name of the VI be changed, but we're where we are.

Given that you have an Excel workbook you will need to use ActiveX. This will require that you have Excel installed. Also, it will be specific to a version of Excel. For instance, a VI written to use ActiveX to work with Excel 2003 may not work with Excel 2007 because Microsoft often changes the ActiveX interface. An alternative is to try to open the Excel file using database functions, although that doesn't always work.

As for examples, there's plenty of them. LabVIEW ships with a few Excel examples. Open the Example Finder (Help -> Find Examples) and search for Excel. For some strange reason NI did not include an example to simply read a worksheet into a set of cells. The attached example, however, does. There's also plenty of examples if you search this forum. There's also the "Excel board", which is just an Excel-specific thread in another forum.
Message 4 of 4
(5,015 Views)