Overview
This example opens an existing Excel workbook, inserts a new worksheet, and inserts a numerical table of data into the new worksheet. Then it saves and closes the workbook.
Description
This VI opens an existing Microsoft Excel document, adds a new worksheet to that document, writes an array of random data to the new worksheet, and then saves and closes the Excel document. It shows how to use the report generation toolkit to open and modify existing excel documents, and how to use this toolkit to add additional worksheets into an existing Excel workbook.
Requirements
Steps to Implement or Execute Code
Additional Information or References
VI Snippet
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
i write these codes in Labview 8.6 , there is an error in it , i cannot understand it , could you tell how to solve it ?
If you need help getting this example to work for you, or getting some code that you've written to work for you, then you should post on the forums (http://forums.ni.com/).
Colden, thanks for posting this. Being able to write to a specific worksheet is a capability that I've been seeking. Do these VIs actually launch Excel to accomplish this? My organization uses Open Office, an open source equivalent of Microsoft Office. The spreadsheet program can read and write xls files, so we have no problem if the spreadsheet VIs don't actually rely on Microsoft Excel. Can you please advise on this?
Hello Drouilhet,
I believe the Report Generation Toolkit requires Microsoft Office to work. I also looked through the actual function calls, and they reference Excel specifically. The functions I use above do open and close Excel, and in fact can leave Excel open if necessary.
So I would say that they most likely do rely on Microsoft Excel. That said, there might be a way to work around those issues - I'm not sure.
3. "Excel Add worksheet VI" Adds a new worksheet to the workset collection. The new worksheet becomes the current worksheet.
So I think 2. and 4. are not really neccesary unless you want to know the number of the active worksheet.
hello, thanks for uploading such a usefull file...i am working on reading data from serial port to excel sheet ...as you said replace this code as your data (but I don't know how to replace with serial port code) can you also post some example file to read data from serial port to excel sheet ...please thank you in advance
Hey janybasha!
The best way to get your question answered is to post on forums.ni.com the details of your question. You can link to this example if you want, but really the first hurdle is to get serial data read into LabVIEW. I'd also like to keep this example focused on a single task.
When you post, make sure you include details on what type of data you're reading in and what hardware you're using to read the data.
When you transition into pushing the data into excel, you'll need to think about whether you want to send all the data to excel at once, or if you want to send smaller chunks of data as your program is running. If you choose the latter, you'll probably want to use the producer consumer architecture (https://www.ni.com/en/support/documentation/supplemental/21/producer-consumer-architecture-in-labvie...), and you'll want to make sure you move the initialization and closing portions of my code outside of your loop.
Hi.
when using this example in a continuos data logging system, this code keeps on adding a worksheet instead of appending to the existing worksheet. can anyone assist in terms of as to how can one monipulate this code to add a worksheet only once and thereafter append addittion data to it?
Regards
Drmotsei
When I have new data available I send it to a loop with this code. Right now i run it every second and it works great. Just put the file path and report reference in shift registers.