From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use write to spreadsheet VI to export data to excel?

Solved!
Go to solution

Hi all,

 

Currently I am using NI USB 6255 to acquire data from a power supply.

 

I would like to collect the voltage of the power supply at every seconds. Currently, I am able to do so if the file path is to a .txt file. However, I want to record all my data directly into excel. Does anyone knows how to do it? I appreciate you help very much.

 

Hereby I attached my vi. A million thanks!

 

Regards,

Vanessa

0 Kudos
Message 1 of 27
(37,533 Views)
Solution
Accepted by VanessaWen

Hi Vanessa,

 

WriteToSpreadsheetFile does what it's name implies: it writes data to spreadsheet files.

Excel can open these spreadsheet files, when the measurement has finished.

 

When you want to input "live" data into an Excel sheet you need to use ActiveX remote control of an Excel application. You will find examples in the forum, it may be worth to look for that special Excel thread

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 27
(37,530 Views)
Solution
Accepted by VanessaWen

I would do something like this if the rate of data recording is as slow as you said.

 

DAQ_defined channel_record to excel_2.png

-----

The best solution is the one you find it by yourself
Message 3 of 27
(37,524 Views)

If you want a true xlsx file, then try using the Write Measurement File express VI.  It doesn't look like it uses ActiveX, but it will write files in the xlsx format.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 27
(37,507 Views)

Hi GerdW,

 

Perhaps my question is not clear enough. Yup, I want to view my data after the programme has stopped. When I tried to open using Excel file, it says the data is unrecognizable. However, if I open using a text file, I could see my data clearly.

 

In that case, what changes should I made to my current program?

 

Thank you so much!

 

Regards,

Xin Wen

0 Kudos
Message 5 of 27
(37,486 Views)

Two comments:

 

  1. Use the timestamp from your data acquisition instead of getting it from the operating system. If you convert your data to a waveform instead of an array, the first element of the waveform is the timestamp. This will give you much more accurate information.
  2. I would not recommend using the Excel version of Write to Measurement File for streaming data. It does not use ActiveX, but it is an XLSX format, which is a zipped set of XML files. Every time it writes, it unzips, adds data, then zips again. This is VERY slow. It is useful for writing static sets of data, but you are much better off with a tab separated text file if you want to stream a spreadsheet compatible file to disk. Excel reads tab separated text files with no issues (and so does Gnumeric, OpenOffice/LibreOffice Calc, Mathematica, and virtually every other analysis program on the planet).
0 Kudos
Message 6 of 27
(37,487 Views)

Hi Anand,

 

My problem is not the rate of data recording. I am unable to retrieve my data using Excel.

 

Vanessa

0 Kudos
Message 7 of 27
(37,481 Views)

If you save the data as a .csv file as I have shown in my example, I am sure you will be able to open the file using Excel. I do it all the time.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 8 of 27
(37,477 Views)

Hi Anand,

 

Do you mind to share your vi? I couldn't find some of the block. I am still learning LabVIEW anyway. Thanks! 🙂

 

Vanessa

0 Kudos
Message 9 of 27
(37,469 Views)

Hi Anand,

 

Do you mind to tell me what is the array block (whereby the output is connected to write to text file) you have used in your design? I really appreciate your help. Thanks!

 

Vanessa

0 Kudos
Message 10 of 27
(37,326 Views)