LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with writing to an Excel file

Solved!
Go to solution

Hello,

I'm working on a program in Labview that should read Data, make it on an array and tranfer it in real time to an Excel file. I have already done that however there are some problemes i could'n solve so i'm here to share them with you and help fixe them if possible :

1) The excel file i'm using to write in has some functions defined on it, used to make calculations with transfered values and each time i run

my program every thing on the the file is overwritten even functions.

2) I have have to specify the rows/colums where i need to write (ex: start with row 4 column C to row 20 column C and jump colum B and row 14 and 15)

3) the VI need to be saved automatically, i did everytnig i've found on the NI forum but still not working.

I guess this is not easy to do but i really need some help so i can carry on my work.

Thank you

MGarry

0 Kudos
Message 1 of 21
(3,332 Views)

Post the code you are using to write to excel and the excel file you're starting with.  Make sure to highlight the cells in excel where you are writing the data.

0 Kudos
Message 2 of 21
(3,328 Views)

Thanks Wayne for the reply, you'll find the code and the Excel file.

 

MGarry

0 Kudos
Message 3 of 21
(3,324 Views)

Maybe you'll have to test it with a simple Excel file and see.

 

MGarry

0 Kudos
Message 4 of 21
(3,309 Views)

If I understand correctly, you take a data sample once every hour over a period of time.  That sample is then transfered to the excel sheet which includes an equation to average every 8 samples.  Is that correct?  Is the program intended to transfer each sample to Excel as it is taken and add it to the table on the front panel as well?

0 Kudos
Message 5 of 21
(3,303 Views)

You've got it right Wayne, and having the samples on the front panel is useful in case i want to modify some values.

 

MGarry

0 Kudos
Message 6 of 21
(3,297 Views)

Does Excel need to remain open for the duration or should it be saved/closed after every sample is added?

0 Kudos
Message 7 of 21
(3,291 Views)

It has to be opened and saved after every sample is added during all the month (then i'll replace the old Excel file by the new one) so we can see every row written in the file and also be able to make sure changes we make take place effectively, there are also some columns (blue) with equations.

 

MGarry

0 Kudos
Message 8 of 21
(3,287 Views)

It sounds like you need a state machine.  Program starts up, opens a new excel file, takes a data point ( 1D String Array) and adds the new data to the table on FP and to the Excel file at a predetermined row and column.  Excel file is saved and closed.  Program waits a set period of time and then takes another data point.  Data added to table and written to next row in Excel.

Every 8 samples/rows a row is skipped so the calculations are not overwritten.  State machine also keeps track of when a new Excel file should be created.

0 Kudos
Message 9 of 21
(3,283 Views)

There is no need to create a new Excel file since i'm working with a specific one, also the Excel file has to be opened all the time, you said something about writing to a predetermined row/column do you mean that samples are intended to cells not to rows? because if it's so i'll have a big trouble to do it because there are too many samples to add.

 

Is this program useful somehow to perform a state machine ?

 

MGarry

0 Kudos
Message 10 of 21
(3,278 Views)