Example Code

Build 2D array and write to Excel


  • LabVIEW Report Generation Toolkit

Code and Documents



This example builds a 2D array of random numbers and writes this data to an Excel spreadsheet.


After a 2D array is created, it is transposed so that instead of two rows of data, we have two columns of data. Then, it is written to an Excel file with the Append Table to Report VI.


LabVIEW 2010 (or compatible), Report Generation Toolkit for Microsoft Office. Hardware: none.

Steps to Implement or Execute Code:

  1. Create a 2D array of random numbers
  2. Transpose the array so that the Excel spreadsheet will have 2 columns instead of 2 rows.
  3. Create a new Excel file
  4. Append the array data as a table into the Excel file
  5. Open and display the data in a maximized window
  6. Close the report and references to it


Additional Information or References:


Build 2D array and write to Excel sn.png

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

Justin Parker
National Instruments
Product Support Engineer

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


Very usefull, thanks!