LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Inserting new data to a new row in same Excel sheet continuously

Solved!
Go to solution

Hi everyone, 

 

I am using LabVIEW 2010 and there is a probelm I need to ask regarding to Export the data from LabView to an Excel. Basically, I have been able to transfer the data "once" a time to a new or selected Excel spreadsheet, but only can be "ONCE" when I run the VI, So my problem is, I need the data to be inserted to a same Excel sheet everytime I press run and the new data will not replace the old one, instead it should go to the next new row or column. I really need all answer regarding to my problems, any suggestions and ideas are welcome.

 

I Attached My Current VI and an image describe the result I needed

Thanks for Answering 

Download All
0 Kudos
Message 1 of 26
(5,071 Views)

Any Suggestions are still welcome ^^

0 Kudos
Message 2 of 26
(5,049 Views)

A common technique is to open the file (any resource) on the first call and store the reference to it in a Shift Register in a While Loop that'll run only once.  The False case increments the row value, so every time you call this (as a sub VI) you'll write to the next row.

 

La_BD.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 3 of 26
(5,020 Views)

Hi Jim, thanks for the solution, I will try to combine this system with my I/O assistant, anyway, is that possible for you to attached the VI for me?

 

Thanks

Ery

0 Kudos
Message 4 of 26
(5,003 Views)

That image is a VI Snippet.  Just drag it onto a block diagram and you'll have it.  Besides, I only slightly modified the VI you provided.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 5 of 26
(4,970 Views)

Thanks Jim, I try drag and drop to Block diagram, but it's not working, I just not too sure what to put when the false case.

 

Ery

0 Kudos
Message 6 of 26
(4,961 Views)

No problem, ery.

 

This is something you might also do when working with DAQ, a data file or any resource that you need to open once and use repeatedly.  The True case opens the file only on the First Call.  The False case simply passes the value from the Shift Register to be used again without the overhead, or wasted memory, of reopening the reference.  I could have passed the Row wire around the Case Structure as the uninitialized Shift Register would have started with zero anyway.

 

Good luck.

 


jcarmody wrote:

A common technique is to open the file (any resource) on the first call and store the reference to it in a Shift Register in a While Loop that'll run only once.  The False case increments the row value, so every time you call this (as a sub VI) you'll write to the next row.



Example_VI_BD.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 7 of 26
(4,957 Views)

Hi Jim, thanks, It is working perfectly, ^^

But I just wonder how do you set up the time delay on each run? I have put 5 second delay on the while loop, but the result is the system run from 0 and increasing 1 second everytime it loops, how do I set to 5 second constant delay?

 

Thanks Smiley Wink, I include my VI

 

 

0 Kudos
Message 8 of 26
(4,952 Views)

You weren't getting five seconds between writes because your VI was using the loop iteration counter to set the value to the Time Delay Express VI.   This would have given you the five seconds you wanted: La.png

 

What I had in mind was that you'd use your VI as a sub-VI like this:

 

Example_VI_BD.png

 

Leave the Loop Condition in your VI like this : La.pngand control timing in the calling VI.

 

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 9 of 26
(4,944 Views)

Great!! Tha's exactly what I need, Thanks a million Jim ^^

There is another issue is when running this system, how do I make it open an Excel so it will not create a new sheet? for example I put something on sheet1 excel, but when running this VI, it will create a new sheet2, what I want is this system open and input the data to sheet1 not creating a new sheet2

 

Thanks ^^

Ery

0 Kudos
Message 10 of 26
(4,940 Views)