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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to read an excel file without using ActiveX

Hi samehA,

 

but the Vis that I found give only the number of sheets and rows in an .xlsx file.

I'm pretty sure there are also XLR8 functions to read the content of the sheets. And I'm sure this is shown in the XLR8 example VIs, too…

( I own a XLR8 license, but haven't installed it on my work computer, so I cannot check the needed VIs right now.)

 

to read an xlsx file format, and load seperately each worksheet in a 2D array ? 

As said before (several times): you can parse the sheet.xml data on your own after you UNZIP the XLSX file…

Best regards,
GerdW


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

This snippet can you get started. Of course, you still need to program the xml parsing part, I never did it, but I guess it is not that difficult...

 

xlsx_to_data.png

0 Kudos
Message 22 of 28
(1,099 Views)

And of course there's the specification:

https://msdn.microsoft.com/en-us/library/gg548604(v=office.12).aspx

 

Probably a lot of work even just to read it, but it's all there!

0 Kudos
Message 23 of 28
(1,093 Views)

Actually what is in these Excel files what your program needs to read?

Is that some configuration type of data? If so, i would just use config .ini files via the OpenG Config tool. These ini files are also human readable, and very easy to read/write from LabVIEW...

0 Kudos
Message 24 of 28
(1,085 Views)

In fact, the initial .xlsx file is a multi- sheets file ( there are at least 4 worksheets in one file, it depends on the file i select to treat data from), and they are in similar format ( text and number- 2D array in each worksheet), So i need to read data existing in the 2D array of each worksheet, there isn't any configuration type of data.

0 Kudos
Message 25 of 28
(1,077 Views)

@Student_LV wrote:

In fact, the initial .xlsx file is a multi- sheets file ( there are at least 4 worksheets in one file, it depends on the file i select to treat data from), and they are in similar format ( text and number- 2D array in each worksheet), So i need to read data existing in the 2D array of each worksheet, there isn't any configuration type of data.


Ok, but are you really forced to use Excel files? Is this a rigid requirement? The users of your LabVIEW application could easily create and handle csv files. Everything would be just much simpler...

0 Kudos
Message 26 of 28
(1,069 Views)

it was a requirement to read data from .xlsx file but Even when i tried to do it with CSV files, i couldn't put several sheets into one CSV file, i was blocked on how to implement the "sheet" delimiter. i might write VBA code, as was said to me, to have Excel, save all the sheets into one CSV file and develop LabVIEW code to read that CSV file and parse the sheets… 

0 Kudos
Message 27 of 28
(1,059 Views)

Write a LabVIEW program that will run on the PC that has Excel and creates the CSV file that has the multi-sheet data.  Transfer that data file rather than the XLSX file to the PC that doesn't have Excel.

Message 28 of 28
(1,054 Views)