LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

saving into excel

I have this program but i am unable to do 2 things with it. 1) i am unable to get it to start putting the data into the excel template at the same location everytime and 2) i also would like it to save the excel sheet under a new name instead of always having to go in and delete what is in the excel file.

0 Kudos
Message 1 of 6
(3,433 Views)

I don't have LabVIEW 2009 installed on this machine so I can't open your code. If you are using the "Report Generation Toolkit" (an add-on unless you have the Professional Development package) there are some "tools" to do what you need. There is one to open a new worksheet, which would allow you to not overwrite the previously entered data, and there are vi's to allow you to select the cell to start your insert, allowing you to write to anywhere in a sheet. You do have to keep track of where you wrote, I'm doing it in a "Functional Global" or "Action Engine" (searchs on these terms will bring up a number of threads and a very informative "nugget" from Ben). In the LabVIEW Help:Examples:"Excel" there are examples using the activeX calls, am pretty sure that the functionality is present, but I haven't used those is quite a while.

Putnam
Certified LabVIEW Developer

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


LabVIEW Champion



0 Kudos
Message 2 of 6
(3,409 Views)
0 Kudos
Message 3 of 6
(3,398 Views)

 


@Leprechaun wrote:

I have this program but i am unable to do 2 things with it. 1) i am unable to get it to start putting the data into the excel template at the same location everytime and


This is not clear. Where, exactly, is it putting the data, and why is it in the wrong place? You are using Easy Excel Table, and have iteration hard-wired to 10, but the whole code is in a loop. Why 10?

 

 


2) i also would like it to save the excel sheet under a new name instead of always having to go in and delete what is in the excel file.

 

You are using "Rename Worksheet". That just renames the current worksheet. This is described in the LabVIEW Help for that VI. If you want to create a new sheet then you need to use the  Excel Add Worksheet VI in the Report Generation -> Excel Specific -> Excel General palette.

 

Other comments:

  • You should not be creating the DAQmx channels in each loop iteration. Create/close/destroy/clear tasks outside the loop.
  • You are not closing the report at the end of the program.
0 Kudos
Message 4 of 6
(3,388 Views)

I am trying to make it start at A2 everytime but it keeps adding on to the end of the list instead of starting at A2 everytime

0 Kudos
Message 5 of 6
(3,380 Views)

 


@Leprechaun wrote:

I am trying to make it start at A2 everytime but it keeps adding on to the end of the list instead of starting at A2 everytime


I would suggest you create a test VI so you can get the report generation to work properly based on what you want and then you can place the code in your main VI. For example, the following code will add 5 sheets, writing the table to dummy data to each sheet at A2 on each sheet:

 

0 Kudos
Message 6 of 6
(3,366 Views)