LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

writing data to excel without opening worksheet

I am trying to write data generated in my program which is in 2D array into excel. Example "writing table to XL.vi" shipped with labview reads value from tables in the front panel. Observed from the excel file generated, it seems there are 3 sheets created that may cause by 3 sub VIs "cell value" used. Do I get the correct idea about this?

My intention is to write data from the array into excel directly without opening the excel worksheet. Besides, I need to label the columns with characters, before the value of arrays are written into the sheet. Then the excel file should be saved with a file name that is automatic generated. The automatic generated file name is done in this case, I just need to save the file as the
name generated. Can any one give me a hand in this?

Your help will be very much appreciated. Thanks!
0 Kudos
Message 1 of 6
(3,724 Views)
Easy :
use the standard "write char to file.vi" in two steps :
first write the string header, then append the num data. There is a convenient function in the string subpalette to convert arrays to spreadsheet strings.
See the attached vi.

Don't forget to append the .xls suffix to the file name. Yes, this works also on text files...

Watch to what happens with float numbers. There are cases where the num decimal separator can pose problems. There is a workaround. Ask if you need help.
Chilly Charly    (aka CC)
Message 2 of 6
(3,724 Views)
Hi, Chilly Charly,

Thanks for the information. I understand that characters can be written into text file, and I have been successfully wrote characters and a 2D array into the same file. The file is saved in other extension name, but not �.xls�, as this will cause error when opening the file in excel. The file attached could not be opened, as I am using LabVIEW 6.0. If you can be able to write into excel file directly, I am suppose our approach may be different. Is it possible that you save the VI in v6.0 for me? Thanks.
0 Kudos
Message 3 of 6
(3,724 Views)
Thank you for this reply.
I try to do it for a long time.

Please dont say "easy" in the beginning of your post, Because I fell as worst as I am 😉
0 Kudos
Message 4 of 6
(3,724 Views)
Text file names with the .xls extension are openened directly by Excel, without any problem (except the decimal separator, which may be the cause of difficulties in exotic countries such as France...). This is a fact, not a guess... :))
I can't post a 6.0 version, but the diagram is so simple that you will be able to quickly reconstruct it.

CC
Chilly Charly    (aka CC)
0 Kudos
Message 5 of 6
(3,724 Views)
Thanks for your example.I have got my problem solved with slight modification with reference to your example 😃
0 Kudos
Message 6 of 6
(3,724 Views)