LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I write correctly String Array to xls file

Hi All,
I am trying to write String Array in .XLS file. But I am not getting written data from LabVIEW to Excel file as it is. For e.g. if I write "0:100" into array, I should get "0:100" in Excel File. I am posting VI with this question.

Any help is welcome regarding this issue.
0 Kudos
Message 1 of 3
(3,701 Views)
A "spreadsheet file" as written by LabVIEW has little to do with an *.xls file (which is a proprietary Microsoft format), even if you give it a fake *.xls extension.
In your case, the *.xls extension simply forces the file to be opened with excel, which tries to do its best to convert the data. In your case, 0:100 is interpreted as 1:40, i.e. "1 hour, 40 minutes=100 minutes" (format the cell as time format to verify). 😉

Your best bet is to write your data to a plain ASCII text file (e.g. text.txt), then import it into excel while specifying the desired field format ("string" in your case).

If you really want to write a true native excel file, you need to study the shipping example named "Write Table To XL.vi" which uses OLE automation to achieve the task (In the example finder, seach for excel). Alternatively, you could probably also use the NI LabVIEW Report Generation Toolkit for Microsoft Office.
Message 2 of 3
(3,692 Views)
You can use array to spreedsheet string function to write a string spreedsheet file. However since you have ":" in your data it is treated as special character by excel. It stands for range in excel,if i guess it right. But there is provision fo writting strings to excel file.
Message 3 of 3
(3,675 Views)