LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I append excel file rather than replace it?

Hi,

 

I have the attached VI set to write data to Excel, One case structure sends the data to cell B6, the other sends the data to cell B7. The problem is, the data is deleted from one cell when new data is added to another.

 

I think I want to be able to append the data without deleting other cells. Any ideas?

 

Thank you

 

Todd

 

 

0 Kudos
Message 1 of 5
(5,609 Views)

Toddzilla,

 

There are a couple different ways to append to excel files.  A couple links that might get you going are:

 

Can I Add New Data to an Existing Excel File Without Erasing Old Data?

 

Append Data to an Excel Document Every Iteration Using Report Generation Toolkit

 

Are you trying to write over cells B6 or B7, or are you trying to append within the cell itself?  

 

Hopefully this can get you on the right track.  When I append to files I tend to insert rows or append to the end of the file.

Scott A
SSP Product Manager
National Instruments
0 Kudos
Message 2 of 5
(5,570 Views)

Sc

0 Kudos
Message 3 of 5
(5,560 Views)

Scott,

 

I hope to get to the point where my front page grabs my template and incorporates the S/N of the UUT into the file name, then the subsequent pages of testing will fill in the corresponding rows on the excel test report. For example, the main page requires the user to input the serial number of the unit being tested, it then creates a the excel file to be used for the whole test series...then it kicks you off to the pressure proof page, pressures are sent to B6 of the excel file when "write to file" is pressed. The "Next" button takes you to the flow rate page, when the operator hits "write to file" from there, the data records in B7 and so on.

 

So if you can think of another example where the excel file is created and the file name is appended by a user input string, I would appreaciate it.

 

Thank you for your help.

 

Todd

 

 

 

 

0 Kudos
Message 4 of 5
(5,557 Views)

Todd,

 

I would take the New Report vi out of the while loop because the reason it is erasing your data each time is because it is creating a new report each time the loop executes.

 

As for creating the excel file and having the file named by an user input string you can make a prompt user for input vi and then concatenate that string with the rest of the file path to make a new file with the open/create/replace file vi.  At that point you can pass that string to the New Report vi

 

 

Scott A
SSP Product Manager
National Instruments
0 Kudos
Message 5 of 5
(5,529 Views)