LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Appending string and integer to xls file

Solved!
Go to solution

Hi There,

 

I made a program to do data analysis on some waveforms. I need to write the results in my results file. It is a spreadsheet file. I want to write file name along with all the results in a row, each value in each column. I am planning to use the same results file and append data analysis results of my all experiments. I could not figure out how to write string (file name) and integers together. Also when i just try to write all the results only (integers), it is not writing in new line. 

 I am using write to spreadsheet function and am working on labview 8.2

 

Thanks

Yogesh 

0 Kudos
Message 1 of 5
(3,536 Views)

I am attaching image of block diagram of what i tried.

Thanks

Yogesh 

0 Kudos
Message 2 of 5
(3,534 Views)
Solution
Accepted by topic author Yogesh9ic

I am assuming you know that the Write to Spreadsheet File VI will not create an Excel workbook just because you use an extension of .xls. You get a text file. The extension will simply allow your operating system to automatically open Excel when you double-click on the file.

 

That said, %.s is not the format string you want to use for floating point values.  You should use %f, or something else that converts a number to a string. The default format string is %.3f, which uses 3 decimal places.

 

If you have a string that you want to include then one simple way to do this is to convert the numerical array to a string (using the number to string functions), prepend your string to this string array (i.e., inserting an element to the beginning of the array), and then writing out this new string array. The Write to Spreadhsheet File is polymorphic in 8.2 so you'll get the string version when you connect a string array to it. 

Message 3 of 5
(3,522 Views)

Does a day go by where there isn't a question where a new user isn't confused by the difference between a true Excel file and a text file that is created by "Write to Spreadsheet File"?

 

Let's build up the Kudo's for this message in the Ideas board, or suggest some alternatives on how to get rid of the confusion.

 

Otherwise we'll have to let Coq Rouge do his job to eliminate the problem.

0 Kudos
Message 4 of 5
(3,504 Views)

I did not get confused with write to spreadsheet function. I choose xls because i want it to save as .xls file thus making my life easier to open that file with excel and not have to right click and choose to open with excel. The problem i was facing because of string and number was solved by changing all numbers to string. That was stupid of me not to think about changing all the numbers to string

 

Thanks for your help

Yogesh 

0 Kudos
Message 5 of 5
(3,499 Views)