LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

save data to excel

Solved!
Go to solution

hi, 

i need to save data to excel or csv or anything by identical shape of the multicolumn listbox. the columns needs to be included. What should i do?

Download All
0 Kudos
Message 1 of 19
(188 Views)

Hello!

To save data from a multicolumn listbox with its column structure intact, you need to write a script that iterates through its contents. First, you would read the column headers and write them as the first row in your Excel worksheet or CSV file. Then, you would loop through each row and column of the listbox, extracting the data for each cell and writing it to the corresponding cell in your Excel sheet or as a comma-separated string in a CSV file, thus preserving the identical shape. 

0 Kudos
Message 2 of 19
(164 Views)

Use Column Header Strings[] property.

ZYOng_0-1754904645244.png

 

-------------------------------------------------------

Applications Engineer | TME Systems

https://tmesystems.net/

-------------------------------------------------------

https://github.com/ZhiYang-Ong
0 Kudos
Message 3 of 19
(163 Views)

Hi Tim,

 


@tominsek wrote:

i need to save data to excel or csv or anything by identical shape of the multicolumn listbox.


You use the WriteSpreadsheetFile functions…

(You already have string array data available for your MCLB.)

 


@tominsek wrote:

the columns needs to be included. What should i do?


I guess you mean to include the column headers…

 

Write the headers once when you create the file.

Write the MCLB content (items) after you wrote the header…

 


@tominsek wrote:

What should i do?


What's wrong with the code in your images?

Do you encounter any errors or problems?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 19
(161 Views)

yaroxim 837

 

do you maybe have some example how to do that and what should i include?

0 Kudos
Message 5 of 19
(141 Views)

hi gerdw,

 

can you send me an example?

 

yes i get data written like this(image)

0 Kudos
Message 6 of 19
(140 Views)

ZYOng

 

If i make like this, its not okay because data are written like that (image)

0 Kudos
Message 7 of 19
(135 Views)

Hi Tim,

 


@tominsek wrote:

can you send me an example?

 

yes i get data written like this(image)


I guess "yaroxim" probably is just (AI-generated) SPAM…

 

When the data doesn't appear in the right order then you did something wrong.

Unfortunately you didn't post any code so far: why don't you attach your VI (or a simplified VI) with some example data?

 

Are there any "end of line" chars in your MCLB items?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 19
(126 Views)

hi gerdw, 

here is my vi, if you can take a look and alert me to irregularities.

 

below is photo of my MCLB

 

i read data from SQL to MCLB and from that MCLB when button is pressed i saved them to excel thats it.

0 Kudos
Message 9 of 19
(123 Views)

Hi Tim,

 

mind to downconvert for LV2019? Thanks!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 19
(106 Views)