LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write text and numbers to spreadsheet file?

I'm trying to create a spreadsheet file that has string headers that are labels for the number values. For example I am hoping to get:

one     two     three
1         2         3

I need at least 10 significant digits for the numbers. I want it to be formatted so that it will open as a spreadsheet file and any human can easily understand what each number represents from the headers. I've been having trouble mixing strings and numbers as well as saving the file as a type recognized by spreadsheet programs.

I have included what I have been working on. This is the best scenerio I have been able to get. Unfortunately, I have about 20 values I want to save, so the way I have it now is not only cumbersome for that many values, but it also is not formatted for spreadsheet programs.

Also, I would like to be able to add numbers to the end of the spreadsheet and still retain the string headers/labels during each iteration of the program. For example:
one   two    three
1      2         3
4      5         6

I appreciate your help!
Kathryn
0 Kudos
Message 1 of 8
(8,905 Views)
You did not attach anything, but why not just convert your numbers to text. or you could write your text as a header and then write your numbers as seen in the vi below. If you have anymore questions let me know, and please post your version that you tried.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 2 of 8
(8,904 Views)
Joe,
Thanks for your help. Hopefully I attached it this time (thanks for your patience)... this is my first post. I have labview 8.0, could you re-attach your file so that I could open it with 8.0?

Thanks!
0 Kudos
Message 3 of 8
(8,900 Views)
here you go. I'll think you will see where you went wrong when you look at the VI.  If you need anything else just let me know.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 4 of 8
(8,898 Views)
Joe,
When I open your VI, LV can't find the "Write to Spreadsheet File (string).vi" and the "Write to Spreadsheet File (DBL).vi". I do have the "Write to Spreadsheet File.vi," that is what I tried to use multiple times in different ways.

When I do get your program running (after it fails to find the two "missing" vi's - even though they are there), the wire connecting the "Write to Spreadsheet File (string).vi" to the string input is broken. This is the problem I have been having. The "Write to Spreadsheet File.vi" will accept an array of numbers, but not an array of strings. So, I could only use the "Array to Spreadsheet String.vi" to accept an array of string (as I have done in the program I attached earlier). But, as I discussed before, this method is not producing an acceptable outcome.

Again, I'd appreciate any help.

Thanks!
0 Kudos
Message 5 of 8
(8,879 Views)

In versions lower than 8.20 there was only one vi for the write to spreadsheet string and it only accepted numbers and in 8.20 it is polymorphic meaning that it will accept both. There is instructions on the block diagram on how to modify the write to spreadsheet vi to use strings. Modify this VI and save it as a new name so that you do not corrupt the original. Replace my write to spreadsheet string with the one that you modified and replace my write to spreadsheet with your original write to spreadsheet then it will work. Sorry about that I forgot about the new version being polymorphic.

Which version of LabVIEW are you using?




Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 6 of 8
(8,875 Views)
Joe,
Thanks for the help. I decided to upgrade to LV 8.2 to make things easier. Now I can easily write a table (although, it only opens as a table in MS excel, Open Office Spreadsheet doesn't put the values in table format -  just text). I think this Open Office issue is one of the reasons why I have been dissapointed with the results. But, as long at it works in excel it is acceptable.

Thanks!
Kathryn
0 Kudos
Message 7 of 8
(8,843 Views)
It is a tab delimited text file so as long as open office can seperate the tabs it should not have any trouble. You may want to see if it does a better job opening a comma seperated file, all you have to do is change the delimiter and try it. just a suggestion.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 8 of 8
(8,837 Views)