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.

Example Code

Write Data to User-Selected Cell in Excel Spreadsheet

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This example demonstrates opening Microsoft Excel and writing data to the active cell (the cell that is selected).

 

 

Description

ActiveX is used to communicate with Microsoft Excel. The active cell will start off as the upper left hand corner of the spreadsheet. The front panel of this example has three buttons, Open/Create to create a new Excel spreadsheet or open an existing one, Write to Active Cell to write random data, Stop to stop the program. Property nodes are used to open or create the Excel sheet and write to the active cell.

 

 

Requirements

LabVIEW 2012(or compatible)

 

 

Steps to Implement or Execute Code

1. Make sure Excel is closed
2. Open and Run the VI "Write to Excel Active Cell_LV2012_NI Verified"
3. Choose if you want to Create a New File or an Existing one
4. Click on Open/Create
5. Choose the file from the dialog if you chose open existing. (Skip this Step if you clicked on Create New File)
6. Choose the cell where you want to insert the data is the excel sheet
7. Select the number of rows and columns to be inserted
8. Click on Write to Active Cell and check updated excel sheet
9. Stop the VI

 

 

Additional Information or References

FP.PNG

 BD.PNG

 

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Product Support Engineer
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
jjjmirko
Member
Member
on

could you convert the file for previous labview version?

freighTrain
NI Employee (retired)
on

Which version?

Humphrey H.
Applications Engineer
National Instruments
pmv
Member
Member
on

Can you please convert it into labview version 2010

lucian.grec
Member
Member
on

how do you select the active cell programatically?