LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read continuously excel data

Hello all, 

I am working on an application which consists of  Excel sheet which is updated with new data for every 10 secs ( approx ).  I need to read the sheet continuously and Parallely  I need to write& save the data on another destination.  As of now leave the writing part.. post your ideas for the reading the sheet continuously & update 

0 Kudos
Message 1 of 8
(3,595 Views)

Are you reading from an actual Excel spreadsheet (.XLS or .XLSX) or are you reading from a CSV, which is often referred to as a spreadsheet file?  These are two different file formats and will require different methods.

 

CSV can be read using the "Read from Spreadsheet File" VI on the File I/O palette. 

XLSX can be read using the Report Generation Toolkit, if you have it installed and activated. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 8
(3,573 Views)

There are multiple steps and situations that you have not described, and we cannot look at the code you failed to post.  Here are some of the issues:

  • Are the "Excel data" written to and read from an Excel file (.xls or .xlsx) or a Text file (.csv)?
  • Are you trying to read from a file that is already opened (in some other context) and being modified?  [This sounds, to me, especially tricky and dangerous].
  • Is there any reason to abandon this particular approach in favor of "Save the most recent data in [fill in the blank -- a Shift Register, a Global, a VIG/FGV/Action Engine, Other]"?

Bob Schor

0 Kudos
Message 3 of 8
(3,569 Views)

ya i am having ( .XLS ) excel sheet . i am using Report generation for that . now post your views . 

0 Kudos
Message 4 of 8
(3,517 Views)

Hi, 

 

don't sure that it's advise to read and write in same time in a file.

you can create a copy of your (.xls) file with a quantity of data kwnon and delete it when you will finish to read data inside. repeat this opération to avoid reading and writing data in a same file.

 

 

 

Kudos are welcome.Smiley Happy 

0 Kudos
Message 5 of 8
(3,514 Views)

thank you . 

 i am also in the same strategy to do this. 

but i have an another doubt in this 

If i am deleted cells in last few rows  (using report generation toolkit )  . after that also cells are with border . so i need the  cells with no border ( if dont have a data ) 

 . plz post your idea for this 

 

0 Kudos
Message 6 of 8
(3,511 Views)

@Mrtechie wrote:

ya i am having ( .XLS ) excel sheet . i am using Report generation for that . now post your views . 


Yes sir, right away, sir!

 

  1. New Excel Report, Read Worksheet into LabVIEW Variable "Excel Data", Dispose Report (which closes Excel).
  2. In LabVIEW, do whatever computations you need to do (including acquiring more data) with Excel Data.
  3. New Excel Report, Write Worksheet using Excel Data, Save Report to File (can choose new filename or overwrite old file, your choice), Dispose Report.

As several of us have told you, you do not want to be reading from and writing to the same Excel File repeatedly.  You can (with a fair amount of skill, experience, and effort) write a routine to "manipulate" an Excel Worksheet, changing isolated cells, but you run the risk of "making a real mess of your data" in the process.  Particularly for a beginner, or someone who doesn't quite know what they are doing, the "Get the Data and Close Excel", "Use the Data", and "Save the Data and Close Excel" method we've been advocating is what I, anyway, strongly urge you to try.

 

Bob Schor

0 Kudos
Message 7 of 8
(3,498 Views)

And going the open, write, close, open, read, close, repeat ... route will be slow, EXCEL doesn't open and close quickly.

 

What are you trying to do that requires you write to the spreadsheet and read it in parallel? Explain the concept and we might be able to offer alternative concepts.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 8 of 8
(3,491 Views)