10-28-2021 06:31 AM
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
Solved! Go to Solution.
10-28-2021 08:15 AM
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
10-28-2021 09:02 AM
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.
10-29-2021 05:13 AM
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.
So to answer your specific questions (to the best of my knowledge -- and I might be wrong!):
Bob Schor