LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save data to an excel

Solved!
Go to solution

Hello guys~ I have a little problem about write data into an excel and here is my code in attachment

The data is correctly save into excel but when next data came in it well cover the first data which was created and how to save the new data to next row?  

And another problem is when I running my program the excel file will open and close repeatedly until I stop my program... 

 

Hope guys can help me to figure out 1.PNG2.PNG

0 Kudos
Message 1 of 5
(2,100 Views)
Solution
Accepted by topic author tim.ko

You need to increase the position (now 0,0)...

 

And only insert the header if the file is empty.

 

Using the report generation toolkit is an expensive way to create a csv file. If you want a text file, why not write to a text file? It's easier as well, as you can simply attach new rows. There's no need to know the number of rows already present.

0 Kudos
Message 2 of 5
(2,071 Views)

There is another "sad" side effect of using the RGT to create .csv files (which are not "Excel" files, but rather "Comma-separated-variable" files, even if (by default) LabVIEW separates the columns with <tab> characters.  The main reason that "by willful misdirection" they get called "Excel" is that Microsoft assigns this extension an Icon that suggests they come from Excel.

 

Excel can, in fact, open .csv files.  However, modern (Office 365) versions of Excel will "complain" if you double-click such a file that it isn't an Excel file (true!).  Furthermore, I found, when trying to save an RGT file I'd saved with a .csv extension on this Forum as an "example" that I couldn't -- the format was apparently not recognized as a "legitimate" file format.  Changing the extension to .txt didn't help -- I ended up compressing the file to a .zip file.

 

One other eye-opener -- I changed my code to save as a .xlsx.  True, writing the Report seemed to take a second or two longer, but I now had a true Excel file, and it was significantly smaller in size (roughly half the size).

 

Bob Schor

0 Kudos
Message 3 of 5
(2,067 Views)

Hi wiebo

Thanks for your responded and opinion , you are right ! it's too expensive to use Report , I think I just complicated my idea and figure out what's wrong with it …..

 

 

 
 
0 Kudos
Message 4 of 5
(2,043 Views)

Hi Bob_Schor

 Thanks for your sharing , I think this is my misunderstanding to "Excel"

 Your respond is very useful and I think I'm realize what's different about Comma- separated-variable and it's not exactly a Excel file

 

Thanks again!

 
 
 
0 Kudos
Message 5 of 5
(2,040 Views)