LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Report Generation Toolkit - load data into an open Microsoft Excel worksheet

Solved!
Go to solution

Hi,

 

I would like to load data from LabVIEW into an Excel worksheet which is open at the same time.

 

Does anyone know if this works with the LabVIEW Report Generation Toolkit? Does it only work if the worksheet is closed?

 

Thanks in advance

Noah

 

 

 

 

0 Kudos
Message 1 of 4
(1,604 Views)

In order to work with Excel, the Report Generation Toolkit (RGT) needs an "Excel Reference" (the "wire" that connects all of the RGT functions).  It gets this by executing (at some point) the "New Report" (I'm not on my LabVIEW computer, so I might not have the exact correct name for this VI).

 

So the answer to your question, "Can you load data into an Excel Worksheet that is (already) open", the answer is "Yes", and, in fact, you can only load data into an Excel Worksheet after it is open.  The "catch" is that you need to use LabVIEW to "open" the Worksheet.

 

The order of Function Calls when working with the RGT always starts with "New Report", and (almost always) ends with "Dispose Report".  The first opens Excel (using "hooks" into Microsoft Excel), and the second closes Excel.  I think (but see caveat about not having LabVIEW around to check on this) that if you make changes (or "write") to Excel, you need to Save Report (or something similar) before Dispose (or maybe it's a switch on Dispose?).

 

Bob Schor

Message 2 of 4
(1,569 Views)

Thank You very much for your answer 🙂

 

Does that mean that I can't write data via LabVIEW into an excel sheet which I already opened "by hand" before?

Does it only work if LabVIEW opens a "closed" excel file?

Can I see the changes (writing the data into a cell) which are made by LabVIEW to the worksheet live? 

 

Sorry, but I need to know if this very specific case works. I cannot test this case at the moment as I have not yet purchased the Report Generation Toolkit.

 

0 Kudos
Message 3 of 4
(1,562 Views)
Solution
Accepted by topic author _Noah_

The "Report Generation Toolkit" is designed to generate Reports, which (in LabVIEW 2019) can be either HTML, Word (meaning a Microsoft Word Document) or Excel (meaning a Microsoft Excel Document).  The latter two use LabVIEW-generated "hooks" into existing Microsoft software (i.e. Microsoft Office) it assumes you have already.

 

I recommend that you search in this Forum (use the Search bar at the top of the Forum) and type "Revised Excel Report Example".  I wrote this in 2014, using an older version of the RGT.  Since you appear to not yet have this Toolkit, I'm attaching a Snippet (updated to LabVIEW 2019) so you can see how easy it is to generate an Excel Report, with Headers, 2-D columnar data, even Graphs (of the data), as shown in the attached output file (if I remember to attach it!).

 

This particular routine is designed to "Create a Report".  It "starts with nothing", creates everything, saves the data to a named Excel Workbook, then closes Excel.  However, in answer to your question, if you eliminate Step 14 (to Save and Close Excel), you will see the Report in an opened version of Excel (which will need to "share Screen space" with your LabVIEW code, perhaps on another monitor?).

 

There are also techniques (when you have some more experience with the RGT) to take an existing Excel Workbook and modify it ...

 

Here's the Snippet of the example, updated for LabVIEW 2019.

Revised Excel Demo (LV 2019).png

 

So to answer your specific questions (to the best of my knowledge -- and I might be wrong!):

  • I "believe" that Excel needs to be closed when you start to use the RGT to generate an Excel Report.  I do know that you can open an existing Excel .xlsx file and modify it, but this is trickier than generating an entire Report (with multiple SpreadSheets if required, with Graphs, lots of Tables, Row and Column headers, etc.).
  • The RGT, when considered strictly as a "Report Generator", starts with no Excel File.  However, as mentioned above, it can start with an existing Excel File, but you need to reference this File in your "Create Report" call (step 6 in the Demo) that opens Excel for you.
  • And, yes, you can see the changes to the Excel Workbook as you update and modify your Report.

 

Bob Schor

Message 4 of 4
(1,514 Views)