LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

When is Excel needed in order to save data to an Excel spreadsheet?

I am building a VI that collects simple data from instrumentation. The output would ideally be a nicely-formatted Excel file. The VI would need to do basic operations such as adding worksheets, writing table headers and then save the data in the correct place. If possible, it would be nice to protect the sheets when done then save the file using a runtime-generated filename. The program will be built into an executable and run on some other computer.

 

I see that there are a variety of ways to write to an Excel spreadsheet (simple express VIs, report generation, etc). Some examples explicitly say "Excel is not needed to run this", most don't say anything. So, when is Excel needed and when is it not? To what extent can I do the things I listed above on a machine that has no Excel installed? Also, would Excel be needed if I wanted to do the things mentioned above starting from a template Excel file rather than from scratch?

 

Thanks!

0 Kudos
Message 1 of 13
(3,323 Views)

If you want to do anything with an Excel XLSX file, you'll most likely need Excel installed.  In this post, I talked about a way to edit a word document without word installed and the same can be done for an excel document, especially if you have a template file that is already formatted and you only need to add the data.  It might be slightly more complicated with Excel because you are dealing with rows and columns and creating the XML tags for those but it may be possible. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 2 of 13
(3,313 Views)

If you really want a "nicely-formatted Excel File", especially if you mean a file with the .xls or .xlsx extension, the easiest, quickest, simplest way to do this involves using the Report Generation Toolkit to interact with Excel installed on the PC -- LabVIEW "hooks" into the installed Microsoft Excel routine and gets it to "do its thing".

 

There are a number of examples, both in LabVIEW and in the Forums, showing how to do this.  You can create an output file of whatever name you want, on whatever local or network drive you choose (though you should use .xls or .xlsx as the extention).  Because LabVIEW "uses" Excel to do this, you must have Excel installed on the PC on which you run the LabVIEW code.  If you want to use a Template (which is exactly the same as saying "If you want to read an existing Excel File), this is also included in the abilities of the Report Generation Toolkit.

 

Bob Schor

Message 3 of 13
(3,271 Views)

Thank you. It seemed as if the Report Generation Toolkit was the most complete option. Just to clarify, if I go down that route, Excel is needed to both program within the LabVIEW environment and to run it after building it as executable on the target computer, right?

0 Kudos
Message 4 of 13
(3,226 Views)

@aputman wrote:

If you want to do anything with an Excel XLSX file, you'll most likely need Excel installed.  In this post, I talked about a way to edit a word document without word installed and the same can be done for an excel document, especially if you have a template file that is already formatted and you only need to add the data.  It might be slightly more complicated with Excel because you are dealing with rows and columns and creating the XML tags for those but it may be possible. 



Although I knew about the rename-unzip trick, I never thought to actually use it as a coding option! I would consider that a last resort.

0 Kudos
Message 5 of 13
(3,225 Views)

@vpicco wrote:

@aputman wrote:

If you want to do anything with an Excel XLSX file, you'll most likely need Excel installed.  In this post, I talked about a way to edit a word document without word installed and the same can be done for an excel document, especially if you have a template file that is already formatted and you only need to add the data.  It might be slightly more complicated with Excel because you are dealing with rows and columns and creating the XML tags for those but it may be possible. 



Although I knew about the rename-unzip trick, I never thought to actually use it as a coding option! I would consider that a last resort.


This option should be a last resort but it is nonetheless an option, if push comes to shove.  

 

Yes, Excel is required to program in the development environment and to use it in a production setting.  As Bob mentioned, the RGT is a set of wrapper VIs that make calls to the Excel Object Model.  The object model is not some kit that can be downloaded....it is only available to a computer with Excel installed.  

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 6 of 13
(3,219 Views)

If you are using the NI Report Generation Toolkit then you need Excel installed on the machine.

 

If you do not want to go to the added expense of installing Excel (My company refuses to install Excel on every computer used in our test lab) then I highly suggest the third party add-on XLR8

 

 http://sine.ni.com/nips/cds/view/p/lang/en/nid/212056

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 13
(3,214 Views)

Another option if you don't want to have Excel installed is the Write To Measurement File Express VI:

Untitled.png

 

This doesn't allow you to customize the file by creating new worksheets, etc., but it is a really quick way to get LabVIEW data into an Excel file without having Excel installed.

0 Kudos
Message 8 of 13
(3,203 Views)

Of course, if you use the Write to Measurement File Express VI to create a file with the .xlsx extension on a PC that doesn't have Excel, you might wonder what you are going to do with that file -- you can't use Excel to process it (the PC doesn't have Excel, remember?), and I'm assuming that if it really is an Excel-specific file (as suggested by the .xlsx extension), then even LabVIEW won't be able to read it back.

 

Bob Schor

0 Kudos
Message 9 of 13
(3,187 Views)
@Bob_Schor wrote:

Of course, if you use the Write to Measurement File Express VI to create a file with the .xlsx extension on a PC that doesn't have Excel, you might wonder what you are going to do with that file -- you can't use Excel to process it (the PC doesn't have Excel, remember?), and I'm assuming that if it really is an Excel-specific file (as suggested by the .xlsx extension), then even LabVIEW won't be able to read it back.

 

Bob Schor


The data has to be acquired and then sent out by email. The computer running the program is only supposed to acquire the data and do nothing with it. Not having Excel would actually be an advantage because it would mean nobody could modify the data before sending it out. It doesn't look it's possible for what I need, though, so having Excel will likely be a requirement.

0 Kudos
Message 10 of 13
(3,182 Views)