This VI shows how to edit individual cells in a pre-existing Excel spreadsheet.
We are using ActiveX controls with property and invoke nodes to programatically change values and styles in Excel going either cell by cell or by changing a range of values.
Building the Example below:
1) Open Excel programatically with an ActiveX Property Node that is linked into a "Workbooks" ActiveX Invoke Node
(For this example, we send the path file from a control on the front panel)
2) Open the specific sheet within the Excel file using the name of the sheet 3) Make a Worksheet Invoke Node and use the refnum constant from that Invoke Node to select your sheet 4) Find a range in that sheet to edit by using the Range property in the Worksheet Invoke Node 5) Use the range refnum to edit the full range you selected or send in coordinates and the new values all over the worksheet 6) Close all open references
Hardware and Software Requirements
This needs the ActiveX framework that comes with all Windows Operating systems. LabVIEW 2012 or compatible.
Steps to Implement or Execute Code
1) Download the attached VI
2) Type out the path and Sheet Name of the excel sheet you want to edit
3) Run the VI
Additional Information or References
For more information, please see the example VI below.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.