ni.com checkout is currently experiencing issues.

Support teams are actively working on the resolution.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Inserting 1D Array into excel rows

Solved!
Go to solution

I have a VI which writes to a spreadsheet.  I generate a 1D array the first time the you run the VI which is placed into a spreadsheet.  If I do it directly I get the entire array only into 1 cell

excel.PNG

 

If I tell it to transpose when writing to spreadsheet I get one value for each row in the first column.  

excel2.PNG

 

The second time I run the code the the VI reads the original array in excel and then appends the new data to the array and overwrites the file.  I would like to do one of two things. 

 

I would either like the data to write vertically with each new set being added to the next column or I want the new data write horizontally across the columns and append new data to new rows. I would prefer to just have the data write to individual cells within the same row fixing the issue in the top picture.  The main issue is that I want one value per cell in excel.  I have attached the VI and the data sheet to this inquiry.  The way it works is you put in the name of the file you would like to save.  Then you run it once.  You can then update the desired crosssection run it again and it should save to the file again.  Any ideas would be appreciated.

Download All
0 Kudos
Message 1 of 10
(6,251 Views)

There's not attachment.

0 Kudos
Message 2 of 10
(6,241 Views)

My browser won't let me attach the files.  Will do so shortly on differnent computer.

0 Kudos
Message 3 of 10
(6,240 Views)
You haven't attached any code or explained what function you are using. If you use the Write to Spreadsheet File, you are not creating an Excel file. You are creating a text file with a delimiter. Tab is the default delimiter. Do NOT name the file with and xls extension.
0 Kudos
Message 4 of 10
(6,236 Views)

As I said in a previous post my browser didn't let me upload the files.  I have  now attached them.

0 Kudos
Message 5 of 10
(6,219 Views)
Still no attachment.
0 Kudos
Message 6 of 10
(6,216 Views)

They are on the original post but I have added them again.

Download All
0 Kudos
Message 7 of 10
(6,209 Views)

A minor quibble -- do not call this "Excel", as you are not using Excel.  LabVIEW's Read/Write Spreadsheet work with .csv files, not Excel's .xls/.xlsx formats.

0 Kudos
Message 8 of 10
(6,182 Views)
Solution
Accepted by topic author Cseaman

If you want to write data into each cell separately, you need to define delimiter (comma).

Check this snippet. You will get an idea. BTW write to spread sheet vi also doing same (Internally).

 

Below snippet writes new data at end (i.e. Row by row). If you want to write data column wise, you need to read all your data from old file & append new data to that & write it again. But it is not a good idea. Simply reading old data (without doing anything) is not a good way.

If you really want to do that, use Excel (Report generation toolkit) & define your cell value.

 

write csv.png

Munna
0 Kudos
Message 9 of 10
(6,171 Views)

Thanks I got it doing what I want now. 

0 Kudos
Message 10 of 10
(6,137 Views)