08-11-2025 03:10 AM - edited 08-11-2025 03:11 AM
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?
Solved! Go to Solution.
08-11-2025 04:31 AM
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.
08-11-2025 04:31 AM
Use Column Header Strings[] property.
08-11-2025 04:32 AM - edited 08-11-2025 04:33 AM
Hi Tim,
@tominsek wrote:
i need to save data to
excel orcsvor anythingby 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?
08-11-2025 04:56 AM
yaroxim 837
do you maybe have some example how to do that and what should i include?
08-11-2025 04:58 AM
hi gerdw,
can you send me an example?
yes i get data written like this(image)
08-11-2025 05:02 AM
ZYOng
If i make like this, its not okay because data are written like that (image)
08-11-2025 05:24 AM - edited 08-11-2025 05:25 AM
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?
08-11-2025 05:28 AM - edited 08-11-2025 05:32 AM
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.
08-11-2025 05:37 AM