LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read data from Excel via .Net interface

Solved!
Go to solution

I'm currently developing an application with a .Net interface for Excel. I really don’t like to use the NI LV toolkit because of the legacy ActiveX interface. Writing to Excel works just fine, but reading from a spreadsheet fails at the point where I am trying to convert the values from the .Net reference to LV variant. Does anybody have a working solution for the problem?

I’ve attached my current status.

0 Kudos
Message 1 of 11
(4,837 Views)
Solution
Accepted by topic author aptivo

This thread indicates that 2D-array is not handled by ".NET object to Variant", and proposes the solution of reading cell by cell.

Certified LabVIEW Architect
Message 2 of 11
(4,809 Views)

I like the EPPlus .NET DLL

https://github.com/JanKallman/EPPlus

You don't have need Excel to be installed !

-------------------------------------------------------------------
Eugen Wiebe
Bernstein AG
CLAD - Certified LabView Associate Developer
Message 3 of 11
(4,807 Views)

This is true. If using the workaround which is proposed, by reading cell by cell  with nested loops it is working perfectly. 

Thanks a lot! 

0 Kudos
Message 4 of 11
(4,798 Views)

@EWiebe wrote:

I like the EPPlus .NET DLL

https://github.com/JanKallman/EPPlus

You don't have need Excel to be installed !


Do you have an example of using this Library in LabVIEW?

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 5 of 11
(4,720 Views)

Is this library thread safe? In my use case it may occur that two excel files are created at the same time.

0 Kudos
Message 6 of 11
(4,661 Views)

I found a link:

 

https://forums.ni.com/t5/LabVIEW/Create-spreadsheet-using-Open-XML-SDK-Net-with-Labview/td-p/3235208

 

I've just tried it and it is really easy to use.

Message 7 of 11
(4,652 Views)

Hey aptivo,

Thank you for reporting this, I filed a bug report with NI.


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
0 Kudos
Message 8 of 11
(4,620 Views)

I've done this as well and I got a reply yesterday. It is filed under CAR 732638.

0 Kudos
Message 9 of 11
(4,602 Views)

Hi everyone,

Bugsy26_0-1689758351046.png

 

The above method is the only one working ok found by me so far. But for large files it takes too much to load them. I fell asleep near the computer for files with 10 000 rows ...

 

The next one, using Value2 property is still not working.

Bugsy26_0-1689758202612.png

 

Has anyone else found a workaround for this matter?

 

Thanks,
Daniel  

0 Kudos
Message 10 of 11
(1,642 Views)