LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write to spreadsheet file append

Solved!
Go to solution

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

0 Kudos
Message 1 of 17
(8,144 Views)

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.

0 Kudos
Message 2 of 17
(8,136 Views)

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?

0 Kudos
Message 3 of 17
(8,121 Views)

 


@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.

0 Kudos
Message 4 of 17
(8,107 Views)
Solution
Accepted by topic author bobholmgren

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.

 

- tbob

Inventor of the WORM Global
Message 5 of 17
(8,099 Views)

 


@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

0 Kudos
Message 6 of 17
(8,096 Views)

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).

0 Kudos
Message 7 of 17
(8,090 Views)

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.

 

- tbob

Inventor of the WORM Global
Message 8 of 17
(8,084 Views)

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.

Message 9 of 17
(8,083 Views)

 


@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!

0 Kudos
Message 10 of 17
(8,074 Views)