‎06-30-2010 02:06 PM
Same problem as this guy here:http://forums.ni.com/t5/LabVIEW/write-to-excel-spreadsheet-in-columns-and-append-to-file-in-a/m-p/10...
I'm in labview 7.1. I am reading in data, and want to append on new columns, whereas the excel spreadsheet function simply appends it onto the bottom of the file.
Is there an easier way to do this, or should I write a VI that reads in a current spreadsheet file, then appends the data to the array as said in that link?
Thanks
Solved! Go to Solution.
‎06-30-2010 02:10 PM
I also don't see how appending the array would help either, since i will need to have this file have 5 columns, and "Write to Spreadsheet.vi" only supports 2d arrays.
‎06-30-2010 02:27 PM
There is no 'Excel Spreadsheet function' unless you are using ActiveX. The Write to Spreadsheet function simply writes a text file and unless you want to switch to using ActiveX and an actual Excel document, then the only way to add columns is by reading in the old file, append the new columns to the array, and write the new.
Don't understand your last comment. No matter how many columns you have, it's still a 2D array. How many dimensions did you think you had when you wrote 3 columns?
‎06-30-2010 03:09 PM - edited ‎06-30-2010 03:11 PM
@Dennis Knutson wrote:
There is no 'Excel Spreadsheet function' unless you are using ActiveX. The Write to Spreadsheet function simply writes a text file and unless you want to switch to using ActiveX and an actual Excel document, then the only way to add columns is by reading in the old file, append the new columns to the array, and write the new.
Don't understand your last comment. No matter how many columns you have, it's still a 2D array. How many dimensions did you think you had when you wrote 3 columns?
Yeah, I know I'm outputting a text file.
Ah, I gotcha, sorry, new to this. I see now that 3 (or 10 as I'll need) columns is a 2d array, thanks.
‎06-30-2010 03:22 PM
If you want to append columns, you would have to read in the spreadsheet data and use Insert Into Array to append to columns. Just specify column index instead of row index. Or you could transpose the array, Insert Into Array using row index, then transpose again. Then write it all back.
‎06-30-2010 03:22 PM
@tbob wrote:
If you want to append columns, you would have to read in the spreadsheet data and use Insert Into Array to append to columns. Just specify column index instead of row index. Or you could transpose the array, Insert Into Array using row index, then transpose again. Then write it all back.
That's what I'm working on now, thanks 🙂
Good to know I'm on the right track
‎06-30-2010 03:43 PM
Its more complex than I thought, all the transposing is throwing me off. Along with the fact that Read from Spreadsheet.vi only handles numbers (so my column labels are not happy, keep getting replaced by 0's).
‎06-30-2010 03:54 PM
Use the polymorphic selector under the Read From Spreadsheet vi to select String and it will read everything as strings. Then your labels will remain intact.
‎06-30-2010 03:55 PM
Read From Spreadsheet does not only handle numbers. See the little box under the function (yours says 'Double')? Click on the arrow and change the type. You can also right click on it and do a 'Select Type'.
This is what is called a polymorphic VI. There are numerous polymorphic functions in LabVIEW.
‎06-30-2010 04:02 PM
@tbob wrote:
Use the polymorphic selector under the Read From Spreadsheet vi to select String and it will read everything as strings. Then your labels will remain intact.
@Dennis Knutson wrote:
Read From Spreadsheet does not only handle numbers. See the little box under the function (yours says 'Double')? Click on the arrow and change the type. You can also right click on it and do a 'Select Type'.
This is what is called a polymorphic VI. There are numerous polymorphic functions in LabVIEW.
Thanks!