NI Home > Community > NI Discussion Forums

LabVIEW

Showing results for 
Search instead for 
Do you mean 
Reply
Member ery
Member
ery
Posts: 18
0 Kudos
Accepted Solution

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

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 

Member ery
Member
ery
Posts: 18
0 Kudos

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

Any Suggestions are still welcome ^^

Trusted Enthusiast
jcarmody
Posts: 2,037

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

[ Edited ]

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
Member ery
Member
ery
Posts: 18
0 Kudos

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

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

Trusted Enthusiast
jcarmody
Posts: 2,037

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

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
Member ery
Member
ery
Posts: 18
0 Kudos

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

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

Trusted Enthusiast
jcarmody
Posts: 2,037

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

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
Member ery
Member
ery
Posts: 18
0 Kudos

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

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 :smileywink:, I include my VI

 

 

Trusted Enthusiast
jcarmody
Posts: 2,037

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

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
Member ery
Member
ery
Posts: 18
0 Kudos

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

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