LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extra characters when writing 2D array to spreadsheet

Solved!
Go to solution

I am trying to write some 2D data to a spreadsheet file, but I am getting extra characters at the start of the file. I only get extra characters when I have a user selected file to write the data to. If I let LabVIEW create the file, then there are no extra characters in the file. I created a VI that shows the problem that I am having. 

 

Am I missing something, or is LabVIEW putting those characters in there for a reason?

 

 

Thanks!

-Andrew

 

Download All
0 Kudos
Message 1 of 6
(3,225 Views)

I cannot reproduce your problem, I get 2 rows appended to the CSV whether I input a filename into the front panel or I leave it blank and use the dialog. Either way, I think you should get rid of the file open and close functions.

0 Kudos
Message 2 of 6
(3,222 Views)

In both your cases you tried was LabVIEW creating the file? If I create the Stats.csv file before running the program and then run the program, that is when I get the extra characters. 

0 Kudos
Message 3 of 6
(3,212 Views)
Solution
Accepted by topic author adekruif

If I create a blank file in Excel 2010, and save as .csv, I have no problem. I run your VI and I have 3 rows, the first one is blank since the file was already created.

 

If I create a blank file and save as .xlsx, then go into windows explorer and change the extension to .csv, I get a similar output to yours. It seems like when you create the file before running your VI you might be attaching the .csv extensions to something that is not actually a .csv.

Message 4 of 6
(3,205 Views)

The real question is "Where did that initial file come from?"  It looks a lot like you just saved an xlsx file and expected it to work like a csv.  That will not be the case.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 6
(3,195 Views)

@Gregory wrote:

If I create a blank file in Excel 2010, and save as .csv, I have no problem. I run your VI and I have 3 rows, the first one is blank since the file was already created.

 

If I create a blank file and save as .xlsx, then go into windows explorer and change the extension to .csv, I get a similar output to yours. It seems like when you create the file before running your VI you might be attaching the .csv extensions to something that is not actually a .csv.


Aha! I had a file that was created as a *.xlsx and then converted in windows explorer to a *.csv. That would explain the extra characters when I create the file and no extra characters when LabVIEW cretaes the file. 

 

 

Thanks!!

0 Kudos
Message 6 of 6
(3,151 Views)