Reading Excel Data Programmatically Using the Report Generation Toolkit

製品と環境

このセクションは、サンプルの作成に使用された製品およびOSを反映します。

以下に示された製品を含め、NIのソフトウェアをダウンロードするには、ni.com/downloadsをご覧ください。

    ソフトウェア

  • LabVIEW Report Generation Toolkit
  • LabVIEW

コードとドキュメント

添付

すべてをダウンロード

Overview:

This simple program is a demonstration of how to use the LabVIEW Report Generation Toolkit to read data from Excel programmatically.

 

 

Description:

The first part of the program is a File Dialog Express.vi which asks the user to select the Excel file that he wants to read (use the read_excel_values.xls in the attached zip file).  Then the correct worksheet is selected with the "Excel Get Worksheet.vi".  This is done with the worksheet index number for the first two sheets and by worksheet name in the last.  After each "Excel Get Worksheet.vi" there is an "Excel Get Data.vi" which will grab the data corresponding to the start and end position (or location depending on the type of array) passed into the SubVI.  For the 2-D array data types you must give start and end points for the array.  For non-arrays you only need to give the location of the cell.

 

 

Requirements:

LabVIEW 2012 (or compatible)

LabVIEW Report Generation Toolkit 2012 for Microsoft Office (or compatible)

 

 

Steps to Implement or Execute Code:

  1. Download and Unzip the attached folder "Read Excel Programmatically.zip"
  2. Open "Read Excel Values.vi"
  3. Run the VI and a dialogue will appear
  4. Browse to the excel file you'd like to use, and continue

 

Additional Information or References:

 

Block Diagram

 BD.PNG

 

 

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

Justin Parker
National Instruments
Product Support Engineer

NIコミュニティのサンプルコード交換のサンプルコードは、MIT Licenseによりライセンス供与されています。

コメント
Todd S.
NI Employee (retired)

Great code!  Thanks for sharing this!

Todd S.
LabVIEW Community Manager
National Instruments
alemaobmm
Member
Member

Tks too!!

aartjan
Active Participant
Active Participant

got me started quickly with reading Excel files. Thanks!

Student_LV
Member
Member

Hi ! 

I was reading the discussion and i didn't find an efficient solution to read a muti-sheets .xlsx file in labview, I want to load the content of each worksheet and get a 2D data array.

Does someone have any idea about how to solve this please?

Thank you.

XLABS
Member
Member

Easy Solutionread excel xlsx.png

sam67
Member
Member

Hello everyone, I hope you guyz are doing well. I need your help, I want to search some integer values which maybe 100 rows and store in one array for further uses. I am confused which one algorithm is working faster in this scenario. If any recommendation or someone already did that type of searching then please help in this problem. Thanks to all. 


@Justin_P wrote:

Overview:

This simple program is a demonstration of how to use the LabVIEW Report Generation Toolkit to read data from Excel programmatically.

 

 

Description:

The first part of the program is a File Dialog Express.vi which asks the user to select the Excel file that he wants to read (use the read_excel_values.xls in the attached zip file).  Then the correct worksheet is selected with the "Excel Get Worksheet.vi".  This is done with the worksheet index number for the first two sheets and by worksheet name in the last.  After each "Excel Get Worksheet.vi" there is an "Excel Get Data.vi" which will grab the data corresponding to the start and end position (or location depending on the type of array) passed into the SubVI.  For the 2-D array data types you must give start and end points for the array.  For non-arrays you only need to give the location of the cell.

 

 

Requirements:

LabVIEW 2012 (or compatible)

LabVIEW Report Generation Toolkit 2012 for Microsoft Office (or compatible)

 

 

Steps to Implement or Execute Code:

  1. Download and Unzip the attached folder "Read Excel Programmatically.zip"
  2. Open "Read Excel Values.vi"
  3. Run the VI and a dialogue will appear
  4. Browse to the excel file you'd like to use, and continue

 

Additional Information or References:

 

Block Diagram

 BD.PNG

 

 

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