From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I add columns of data to an existing spreadsheet?

My program records data to a spreasheet. Right now it records in columns 1-4. I would like to be able to have a control to set the test number, which will add a new set of columns to my spreadsheet. Test one will record the data in columns 1-4, test two will record in columns 6-9, test three in 11-14... How can I do this?
0 Kudos
Message 1 of 2
(2,190 Views)
If you are using the example Write Table to XL, then this is not difficult because in that example you set the actual column and row to place the data.

However if you are creating a tab delimited text file then this is actually difficult and slow.
To take the following table
1 2
3 4

into a text file the actual string written is 1\t2\n3\t4\n where \t are tabs and \n are new lines.

So to add a new column with the values 5 and 6 you would need to actually read the entire string in then insert the values in the middle of the string. Ending up with the sting 1\t2\t5\n3\t4\t6\n Finally you would need to write the whole string back to the file, replacing all the text.

Evan
National Instruments
0 Kudos
Message 2 of 2
(2,190 Views)