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: 

Data in table does not export to Excel

Solved!
Go to solution

Why the invoke node Export Data to Excel produces empty Excel sheet with no data?

If I manually highlight the table control on the Front Panel, then run the VI again, data get exported. How does one highlight data in the table automatically?

 

Untitled.jpg

0 Kudos
Message 1 of 9
(3,380 Views)

murchak,

 

I think this is happening to you because of the LV data-flow paradigm.  If your screen shot is all that is on your block diagram, then the Invoke Node actually executes first, when there isn't any data in the table. Then, the "Table Control" 2D array is populated after an empty table has been exported. When you run the VI again, the data from the first run is already populated within the table, and thus the it *appears* to working.  In actuality, it was working correctly the whole time, but the first time there was just no data to export because it executed first.

 

You must use data flow (wires, essentially) to ensure that the data is written to the table first before the data is exported to Excel second.  A flat sequence structure or error wires (preferred) can help:

dataflow.png

 

Hope this helps,

0 Kudos
Message 2 of 9
(3,364 Views)
Solution
Accepted by topic author murchak

I thought that at first also but after testing (before I posted Smiley Tongue) I can see the order does not matter.  Only the selection is copied over.  If nothing is selected the sheet will be blank.

Note: you can programmatically select cells using a property node (selection start and selection size).

 

So it does appear to be a bug...

Message 3 of 9
(3,360 Views)

solution:

 

Untitled.jpg

0 Kudos
Message 4 of 9
(3,342 Views)

I just had the same problem. How can this be a solution to set start and size when you don't know who many cells are filled with data?

The only thing you can do is to read the array size and mark the entire array for export. 

0 Kudos
Message 5 of 9
(1,367 Views)

Hi MaSta,

 


@MaSta wrote:

The only thing you can do is to read the array size and mark the entire array for export. 


It works for me without using any selection properties:

When the invoke node is executed then a new Excel workbook opens with the expected data…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(1,344 Views)

@GerdW wrote:

Hi MaSta,

 


@MaSta wrote:

The only thing you can do is to read the array size and mark the entire array for export. 


It works for me without using any selection properties:

When the invoke node is executed then a new Excel workbook opens with the expected data…


Hi Gerd,

you are working with an array, not with a table. For an array I see your results too, for a table I see a blank Excel sheet.

I don't know if MaSta can change to an array.

0 Kudos
Message 7 of 9
(1,316 Views)

Hi Uli,

 

good point, I missed that specific requirement!

 

I don't understand why a programmer wants to use this invoke node at all as the program(mer) has no control over the user actions done on that new Excel workbook. (It's the same with export functions available in the context menu of graphs.)

I would rather write data to a CSV file or handle Excel entirely using ActiveX/RGT functions…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 9
(1,310 Views)

The other method which copies the table data into cliboard does the same job, but has the same requirement, or the clipboard would be empty.

I was just experimenting. I actually hoped for the method to come up with a save dialog, means to export the data to an Excel file. Only people with Excel installed could use the method as it is.

0 Kudos
Message 9 of 9
(1,286 Views)