Example Code

Read Password Protected Excel File Using ActiveX

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.


  • LabVIEW

    Operating System

  • Windows

    Programming Language

  • LabVIEW G

Code and Documents



This example will open a password-protected Excel file and read the data from the specified sheet and range.

The data will be shown in LabVIEW as 2D string.

You can change the data format and range as required by modifying the code.

read excel using ActiveX.png

How to Use

Refer to Microsoft Excel namespace documentation in the Related Links section for the details of each class, method, and properties.

Additional Information

This example was tested with LabVIEW 2023 Q1 64-bit with Microsoft® Excel® for Microsoft 365 MSO (Version 2309 Build 16.0.16827.20166) 64-bit.

It is recommended to use the same LabVIEW and Microsoft Excel bitness.

Related Links

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