Showing results for 
Search instead for 
Did you mean: 

Saving data to Excel at the end of the programme

Hi all,
I am stuck at saving and exporting data from LabVIEW to Excel at the end of the programme. My programme works such that a person will need to fill in a value at fixed times. I'm using the numeric control function to write in the values.
I need help to create a buttun "EXPORT" at the front panel so that when all the fields (which are the numeric control) are filled in, gets saved to Excel at the end of the running programme.
regards Aisyah.
0 Kudos
Message 1 of 12
If the "save to spreadsheet" function is triggered by a user event (clicking a "EXPORT" button), it is best to use an event structure to capture the button click and then you can put your save to spreadsheet code inside the corresponding event case.

It would be much easier to save your numeric values to a .csv (comma separated values) file instead of a .xls (excel spreadsheet). Excel will automatically open the .csv file too.

If you really want to save to a .xls file then have a look in this thread for information on how to do it...

In particular the zip attached to this post in the aforementioned thread I believe has functions in it to save to an excel file...
I'm not sure which version of excel it works with, you may need to modify the ActiveX code inside the vis to get it to work with the version of excel you have installed.

Message Edited by Troy K on 09-26-2007 03:43 PM

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 2 of 12



i find the resources very useful. But i can't seem to run the programme. I was prompted to open the sub vi. i did as told but still encounter problem when running. i'm interested at running the first example.




0 Kudos
Message 3 of 12
Can you expand a little on your statement "still encounter problem when running". What problem?
Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 4 of 12

i'm using LabVIEW 8.0. when i press the run button, an error list promts up. It says:

subVI 'excel writing" subVI is not executable.

my format is similar to example 1. attached is my VI. the fields that is accompanied with the square LEDs needs to be filled in. Meaning for example, when at 1min, a few LED will light up. when the LED lights up, a person needs to fill in the box.

The VI is programmed to run beyond 6 mins. After 6 minutes, all fields will be filled in by someone. The data recorded needs to be exported and save at excel.

That's the problem i'm facing right now. cos for now, i can only save it at the initial run of the VI. Not at the end.

I hope u get a better understanding of my situation.



0 Kudos
Message 5 of 12

Hi aisyah,

Troy's suggestion is a good one.  There are a couple examples on writing to Excel in the LabVIEW Example Finder that would be useful to look at as well.  Search "Excel" and try the "Write Table to".  There are also some good examples displaying how to use the Event structure.  Check out the "" example available by searching "event" and selecting "event-driven" in the keyword field.


James R.
National Instruments
0 Kudos
Message 6 of 12

Hi JamesR,

i am still confused on writing to Excel. I want to write in LabVIEW and send to excel. Must i inlcude all the drives before i could write to excel?


0 Kudos
Message 7 of 12
First of all, you will want to get rid of that big Stop Function in the middle of the loop.  That causes Labview to quit.  I don't think I have ever seen a normal program stop that way.  I think that is even one step worse than a program that requires the Abort button to stop it. Smiley Wink
Second, wiring a true to the Continue terminal of the loop will make the loop run forever, (thus the reason the big Stop function was needed).  What you will want to do is wire whatever stop conditions you have to the Stop terminal of the loop.  (Right click the Continue terminal and change it to "Stop if True")
Once the loop stops then another section of your code will start which writes at the data to an Excel file.  Now the question is, do you want Labview to actually open Excel and manipulate it (harder to do because you will need ActiveX calls) or do you want the data written out to something like a .CSV text file which can be easily opened and imported into Excel?  (I would recommend the latter, especially for newer Labview programmers.)  Make sure you have a data flow dependency from your while loop to the next section of code so that code does not execute until the While loop ends.
Look in the example finder for Using Spreadsheet Format.  You will use functions like Write to Spreadsheet file from the File I/O palette or Array to Spreadsheet String from the String palette.  I am not sure what you mean by "Must I include all the drives".
Possible nomination for the Rube Goldberg thread.  In the bottom of your loop, you do a comparison that wires through "End of Test" or "Test in Progress".  Then you compare that to "End of Test" to send it to that big Stop Button.  Why wouldn't you have sent the boolean from the first comparison to the Stop button?

Message Edited by Ravens Fan on 10-03-2007 12:49 AM

Message 8 of 12

Hi Aisyah

I know you posted this message long time ago but i'm trying to do something similar to what you did but not sure how... During the experiment I want to be able to capture data at that point in time by allowing the user to click a button to store the data. if i've understood it correctly, i think you've used a 'numeric control' for this. could you please expand on how you achieved this? say at setting 1, once im happy with the experimental values i want to click a button and data to be either stored in a table in the front panel or exported to anotehr file.


also, i have some manual inputs which are manupilated (eg pressure and temperature inputs are used to calculate the density). but while the program is running, when i change the value at the input the output (i.e. density) does not update. any ideas on how i can overcome this?


thanks in advance

0 Kudos
Message 9 of 12
Please stick to your original thread
Message 10 of 12