NI Home
Cart Cart | Help
Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Currently Being Moderated

Write to a Sheet other than Sheet1 of an Excel Spreadsheet (Report Gen)

VERSION 2

Created on: Jun 30, 2009 12:16 PM by EEsRULEtheWORLD - Last Modified:  Jun 30, 2009 6:39 PM by Hueter

Introduction

This VI will allow the user to write data to an Excel Spreadsheet file with the ability to manipulate the formatting of the data and the particular sheet where the data will be written.  In this particular example, a random array of data is written to Sheet2, and the data points are red if they are less than or equal to 0.5 and blue if the data points are greater than 0.5.  The Excel Get Worksheet.vi is responsible for choosing the Sheet number, and the Excel Set Cell Format.vi is responsible for formatting the data accordingly.

 

There is much information available online regarding custom Excel formatting, for example,this link provides a table of some of these formatting schemes.

 

Additional Notes

Excel 2007 defaults to 3 Sheets.  If you select 3 for the worksheet index, upon creating a new spreadsheet, an error message will occur that says:  You specified invalid Word bookmarks or Excel named ranges.  It is necessary to insert an Excel Add Worksheet.vi before the Excel Get Worksheet.vi in order to account for a 4th sheet without receiving this error message.

 

This example requires the Report Generation Toolkit.

 

This is a screenshot of the Write_to_different_sheet.vi:

Write_to_different_sheet.JPG

 

This is a screenshot of the Write_to_4th_sheet.vi:

Write_to_4th_sheet.JPG

 

Downloads:
Average User Rating
(1 rating)




There are no comments on this document

More Like This

  • Retrieving data ...