LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert rows to excel spreadsheet using LabVIEW

Solved!
Go to solution

Hi

is it possible to get each row of a table in a a different worksheet, for example the 1st row in the 1st worksheet and so on using just EXCEL ADVANCED VIs.

for example the 1st row in the 1st worksheet

 

12.png

0 Kudos
Message 1 of 20
(6,791 Views)

any suggestion

0 Kudos
Message 2 of 20
(6,769 Views)

Hello....
I think you want to ask about to add something in a row of excel sheet...If I am right then here its a very easy task provided by labview functions shown in below .vi

0 Kudos
Message 3 of 20
(6,753 Views)

thanks

i will take a look in your Vi,if it wil help me,because i'm looking to get each row of the same table in a different worksheet of the same excel workbook

0 Kudos
Message 4 of 20
(6,724 Views)

Hi achfire,

 

If you want some more control (like creating worksheets), take a look at this example:

 

https://decibel.ni.com/content/docs/DOC-20014

 

As for getting each row into a new worksheet, tables auto-index at for loop boundaries just like arrays do. On the above example, add a for loop so that you are creating a new sheet, indexing your table by row at the for loop boundary, and writing that row's data to the table. 

 

Let us know if you run into more issues!

 

Best,

David R
Systems Engineer
National Instruments
0 Kudos
Message 5 of 20
(6,692 Views)

2.pngwhere exactly to add the loop,because i already use it but i didn't succed,maybe i missed something

0 Kudos
Message 6 of 20
(6,688 Views)
Solution
Accepted by topic author achfire

Hey achfire,

 

I made a few edits to your code, and it appears to work now. Generally speaking, we don't want to open and close references or files within a loop. Instead we can open the file once, read/write to it in our loop, and then save/close it when finished. I also removed the index array function, as for loops can auto-index at loop bounaries. (This also prevents us from having to wire a number of iterations into the "N" terminal.)

 

Let me know if this helps!

David R
Systems Engineer
National Instruments
Message 7 of 20
(6,656 Views)

What is the purpose of the 1-D string array constant that is empty?  It looks like it is just there to turn the 1-D array into a 1 row 2-D array.  If so, you just need the build array function with only one input and get rid of the empty string array constant.

0 Kudos
Message 8 of 20
(6,648 Views)

Roohcifer

ii doesn't work because i have labview 2012

0 Kudos
Message 9 of 20
(6,643 Views)

Hi achfire,

 

Try modifying your code to look like this:

Excel Multiple Worksheet Example.PNG

 

David R
Systems Engineer
National Instruments
0 Kudos
Message 10 of 20
(6,629 Views)