09-04-2014 04:18 PM
Hello, I am using the "Write To Spreadsheet" vi to write data to a .csv file using the comma delimiter. The append function within the "Write To Spreadsheet" vi always appends to the next row in my .csv file. Is there a way to append to the file where the data left out from the previous write without appending to the next row?
For example I was to use the "Write To Spreadsheet" vi twice with the same file. The first time I write I get:
Product Test1 Test2 Test3
When i write Failure1 and Failure2 using the "Write To Spreadsheet" vi again my .csv file cells become (two rows):
Product Test1 Test2 Test3
Failure1 Failure2
What I would like to see is this (one row):
Product Test1 Test2 Test3 Failure1 Failure2
Is this possible to do with the "Write To Spreadsheet" vi?
Thank you.
09-04-2014 04:20 PM
Not with the Write To Spreadsheet File. You could make you own file format by using the Open/Create/Replace File and the Write Text File. You will have to format your strings before you write to the file.
09-04-2014 04:47 PM
Crossrulz, are there any good examples using the Open/Create/Replace File method showing how to format strings before writing to the file using "Write Text File?"
09-04-2014 05:17 PM
You could actually just dig into the Write to Spreadsheet File and see how they did it. Otherwise going into the LabVIEW example finder (Help->Find Examples) and do a search for Write Text File.
09-04-2014 05:47 PM
You cannot append rows to a file without needing to rewrite the entire file at the end.
A file is just a linear long string of bytes with delimiters for fields and rows. If you want to add a column, virtually all existing data needs to be shifted around and the new column interlaced. You would need to read the entire existing file, manipulate the data, and rewrite the file from scratch.
(Only if you append rows, it can be done at the end of the file without touching the existing content.)