LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do i write data in a new row to Spreadsheet

Hello,

I have to write data an a existing file but i don't want to write under the existing data but i need to write the new data

in a new row. I have 2 loop. The first loop aquired data and the second repete the processus. When the first loop is activate i can

write the data but  what i need is when the second loop repete the processus i want to write the new data in a new row.

Somebody Can help me?????

0 Kudos
Message 1 of 6
(3,278 Views)

How are you writing data to the spreadsheet?  Is is the Write to Spreadsheet File function, Write to Text File, or are you actually trying to put stuff into Excel spreadsheet files?

 

What do the two loops have to do with this?

 

If you attach your VI, we can see what you are trying to do and better be able to help you fix it.

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

Thanks for reply,

I used Write to Spreadsheet File in a file.txt. The first loop do  a simple algorithm and each time it's run I have to stock the data in a file and all data aquired it's for one profil . If i want to simulate 3 profil I increment the second loop .I need to stock each profile in a different row

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

First I'm worried about your abuse of local variables, especially "Indice", "R", and "valuer incrementer".  You have a race condition where when the value is read from the local variable could be before or after the value is written to the terminal.  You have no control as to what value winds up being used.

 

You have a subVI called "Append.vi" that you did not include.  What does it do?

 

You did set up a True constant to the Write to Spreadsheet File's Append input which is what you need for new rows to be added to the end of the file.  So I don't see where you are having a problem with that.

 

I suggest you eliminate the local variables and use wires to pass the data.  If you do that, you can probably also eliminate the sequence structures.  Clean up the code that way and see if you are still have problems and post back then with the fixed VI.

 

 

0 Kudos
Message 4 of 6
(3,260 Views)

Thanks for correction i will fix the local variable,but i made a mistake i would'nt say rows but column. The first loop with all data must be in a colunm and when the second loops (for other profil) repete the first loop I want to write it in a new colomn!

Sorry for my mistake Smiley Surprised

0 Kudos
Message 5 of 6
(3,254 Views)

You won't be able to do that because entering new columns means you are interspersing your existing data and the end of line character with new data.  You could only do it if you were willing to rewrite the entire file on every iteration.

 

My recommendation is you rethink how you save data and save new data by rows.  You can always read the data later and transpose the array to turn the rows into columns.

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