LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to read an excel file without using ActiveX


@pincpanter wrote:

@GerdW ha scritto:

Hi,

 

I see two options:

- Use a 3rd party tool (like XLR8) to read Excel files without needing to install Excel. You find XLR8 using VIPM.

- When you have to deal with XLSX files ("modern" Excel file formats) you can easily UNZIP them (infact they are just a ZIP container). Then you can parse all the Excel data content, which is XML coded…


Sure today you can find a software component for almost any task. However it has a cost. Parsing XML has a development cost too.

samehA should consider which is the best cost-to-benefit way to go, whether buying an Excel licence or something else.

The OP

 


An Excel license would be my very last resort. Last time I checked, Excel upgrades will require new builds of the software. Installing Excel with different languages will also cause the executables not to work. In other words, the price is not the only problem.

0 Kudos
Message 11 of 28
(2,035 Views)

Hi!

I thank all of you for all your responses.

Finally, I register the file as.CSV and read it in labview, but still have a problem. The file has many sheets, how to do to access to each sheet, because in each one there's specefic data i need to extract

0 Kudos
Message 12 of 28
(2,016 Views)

Hi samehA,

 

you cannot save several sheets into one CSV (by default)…

 

- To work with Excel features like sheets and ranges you need to use Excel - or 3rd party tools being able to interpret Excel files without actually using Excel (see my suggestion for XLR8).

- Did you note my other suggestion to unZIP XLSX-files and parse the sheets on your own?

- You might put several sheets into one CSV files, but then you need to implement your own "sheet" delimiter. You need to write some VBA code to have Excel save all your sheets into one CSV file and you need to implement some LabVIEW code to read that CSV file and parse the sheets…

Best regards,
GerdW


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

for your first suggestion, it has a cost to use XLR8, which  i can't afford.

For the second suggestion, would you please explain more to me or attach some examples, i didn't understand how to proceed to do it, knowing that  i don't have Excel installed on my PC.

0 Kudos
Message 14 of 28
(2,007 Views)

Hi samehA,

 

rename a XLSX file to ZIP. Then open the ZIP file to see its content:

- You will find a "xl" folder with a "worksheets" subfolder.

- In there you will find one or several "sheetx.xml" files (with "x" being a number").

- Each of those XML files describes the content of one sheet: you can examine its content using any browser you like to…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 15 of 28
(2,002 Views)

I downloaded the file as .html, zipped and i got files where each one describes the content of one sheet in the excel file, then i opened them with explorer browser, but how to import each sheet of them into labview ? 

0 Kudos
Message 16 of 28
(2,005 Views)

Hi!

I downloaded free evaluation version of XLR8, I found these 2 attached VIs, which read entire spreadsheets of an excel file but, they contains deleted sub VIs, I tried to develop them in order to read the file as a string and then obtain a 2D string array existing in each sheet but i have always errors, would someone please help me to solve this.

Download All
0 Kudos
Message 17 of 28
(1,991 Views)

Hi samehA,

 

downloaded free evaluation version of XLR8, I found these 2 attached VIs, which read entire spreadsheets … but i have always errors

You need to install the XLR8 package through VIPM.

After installation the demo VIs should be runnable without giving errors!

 

I downloaded the file as .html, zipped and i got files where each one describes the content of one sheet in the excel file, then i opened them with explorer browser, but how to import each sheet of them into labview ? 

I guess you are talking about an XLSX file here…

You should have seen the worksheets as XML files inside the XLSX container: this is just text! You can use any kind of XML tool to parse the sheets - or try to parse on your own. The format seems rather straight forward…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 18 of 28
(1,972 Views)

Hi!

I ended up to install the XLR8 package through VIPM and then installed the demo VIs, they are runnable, but the Vis that I found give only the number of sheets and rows in an .xlsx file. However I need to have the 2D array that exists in each worksheet! I have been trying to do this since yesterday , in vain. Had someone experiment to do similar thing before ? to read an xlsx file format, and load seperately each worksheet in a 2D array ? 

ActiveX is out because there isn't Excel installed in the targed PC so no access to activeX interface, and also converting to.cvs is not efficient because i have many sheets to upload.

HELP ! Smiley Sad

 

0 Kudos
Message 19 of 28
(1,946 Views)

You previously said: "for your first suggestion, it has a cost to use XLR8, which  i can't afford.".

Why do not you go on the XML parsing route? As it was advised above, you can even programmatically unzip the .xlsx file, get the xml files, and parse their data very easy!

0 Kudos
Message 20 of 28
(1,939 Views)