LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Save a multicolumn listbox Data to Excel File

Solved!
Go to solution

Hi everybody "I need help"  regarding multicolumn listbox in Labview, I want to Save my data  in excel type and the save Data Should be thesame in What is on Lisbox. How do I begin? Please any Idea?

 

 

LabVIEW Version: Labview 2012



Thank you & Best regards
syrpimp

=======================================================
“You must continue to gain expertise, but avoid thinking like an expert." -Denis Waitley
0 Kudos
Message 1 of 15
(6,020 Views)
Solution
Accepted by topic author syrpimp

HI

 

For writing data to excel , you can use spreadsheet functions (write to spreadsheet.vi) . Input to this function will be the 1d/2d array which will be nothing but the elements in your listbox.

For getting the elements of the list box you can use property node with the property "ItemNames" from where you can get all the elements present in the listbox.

 

Hope this helps!!!

Message 2 of 15
(6,015 Views)

Ok Sir, Let me try..



Thank you & Best regards
syrpimp

=======================================================
“You must continue to gain expertise, but avoid thinking like an expert." -Denis Waitley
0 Kudos
Message 3 of 15
(6,013 Views)

Thanks Sir. it Works



Thank you & Best regards
syrpimp

=======================================================
“You must continue to gain expertise, but avoid thinking like an expert." -Denis Waitley
0 Kudos
Message 4 of 15
(5,987 Views)

Hi there, 

 

I stumbled upon this post while looking on methods to save data in excel file. I've tried using the write to spreadsheet file VI by wiring from the multicolumn listbox to the 2D data channel. I was asked to choose a file to write to and I selected an empty sheet of excel file. However, after running my codes I was unable to open the excel file as there is an error as stated in the snippet attached.

 

 

 

 

0 Kudos
Message 5 of 15
(5,638 Views)

Write to Spreadsheet File does NOT create an Excel file.  It creates a text file where the elements and rows are separated by delimiters (typically commas or tabs for columns, end of line characters for rows).  It is a huge mistake to give the file the extension of .xls or .xlsx because it is not an Excel file and you are lying to Excel about how to open it, particularly .xlsx because Excel is expecting to see a file that meets its XML file format.

 

You should label the file as .txt or .csv.  When you open those using Excel, it will actually import the text file (as opposed to opening it) into Excel.

0 Kudos
Message 6 of 15
(5,631 Views)

Hi RavensFan

 

Thank you for pointing that to me. I never knew that I'm not supposed to save in .xlx or .xlsx files. Now that I've tried saving in .txt I manage to get all the data but the column headers were not saved. Is there a way to get the headers in the .txt file as well?

 

 

0 Kudos
Message 7 of 15
(5,620 Views)

Use a property node to get an array that consists of the column headers.  (1-D array of strings).

 

Use another write to spreadsheet file and wire that column header array into the 1-D array input.  Then wire the data as you are doing now into the Write to Spreadsheet File but be sure you have a True constant wire to append data.

 

0 Kudos
Message 8 of 15
(5,588 Views)

Hello,

 

I want to do the same, save my MultiColumn Listbox data into Excel, but incluiding the format of each "cell". My table has different colors depending on the data.

 

Any idea in how to do it?

 

Im using Labview 2018.

 

Regards!

I attached an example of the data on my multicolumn list box.

0 Kudos
Message 9 of 15
(2,451 Views)

Hi RRK,

 

use RGT (ReportGenerationToolkit) functions to transfer the MCLB data to a spreadsheet and also to set colors of the Excel cells.

 

As soon as you want to use Excel-specific features (like colors, borders, cell formatting at all) you need to work with "real" Excel files. You cannot use spreadsheet files (like CSV) anymore…

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 10 of 15
(2,442 Views)