LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to insert data into my excel template with excel easy table

I am trying to simply insert a table of measurements from labview into an excel report template which can then plot my data etc. I am using New Report.vi to open the template, and excel Easy Table.vi to insert the data. It works fine using the Excel Template 1 from the Sound Power example. I can insert my data into the cells I want, and then create theXY Scatter plot I want from that.
However, when I save that sheet as a template (into my current directory) - so that the next time I insert data I will get an updated plot in the report I want to output, it fails when I run the Vi again using my new template.
The error reported is not helping:
labview error 3008
Automation Interface for the specified class cannot be obtained.  Check if the automation refnum type is the correct class for this operation in Excel_Get_Range.vi->Excel_Insert_Table.vi->Append Numeric Table to Report.vi->Excel Easy Table (num).vi:1->MyInsertCells.vi
Can anyone suggest what is wrong? Why is the Excel_Get_Range.vi having problems? Should I somehow save my template differently? Should I Name the range of cells where I want my data deposited? Why does it work with the template supplied in the example, but not with my saved version of that same template with just a chart sheet added? Can the vi only access templates in the default "microsoft/templates" folder?
This problem is seriously holding up my job.
Thanks
Fred
0 Kudos
Message 1 of 7
(5,592 Views)

fred,

If your new template has multiple sheets, you need to set the active sheet before adding the new data.  Use the "Excel Get Worksheet.vi" to do this.

Message 2 of 7
(5,587 Views)

Thank you so much. This works. You narrowly saved me tearing the last of my already sparse hair out.

Fred

0 Kudos
Message 3 of 7
(5,580 Views)

Fred,

Glad to help.  I recently went several rounds with the same problem.  Smiley Mad

0 Kudos
Message 4 of 7
(5,575 Views)
Just wondering if you know how to solve my next excel problem.
I deposit a column of 4001 freqs, another of 4001 spectrum amplitudes, another 4001 limit line values. and a column of booleans defining whether that limit line value is in the defined range or not (1= plot the limit line value, 0= dont plot). I.E the limit line should only be plotted over part of the full freq range my spectrum is plotted over on the XYscatter chart.
This is really an excel problem - I use a new column using formula which copies the limit line value IF the boolean=1, or inserts a blank space (" ") if the boolean =0. The problem is my chart plots all the " " as zeros (same happens with""), wheras I dont want it to plot at all over the X frequencies where the boolean column has zeros.
Excel doesnt seem to allow an option for a formula to create a null if the test is false. If I go through manually in my resulting limit-line plotting column and replace the blanks with 'nothing', then it works, and my limit line only plots where I want it to. We dont want any manual intervention though. We want to run the labview vi, deposit the measurement data in the correct excel sheet columns, have it update the plot - which is linked to our final report in word.
Any ideas how to automate this - to get excel to only plot the limit line where my boolean column says it should?
thanks
Fred
0 Kudos
Message 5 of 7
(5,569 Views)
Fred
 
One way to attack this is to avoid the Excel issue by doing the formula calculations and populating all the columns in LabView.
 
Can you post an example of the Excel file with some data that plots correctly and some that doesn't?  That way I can see exactly what you are trying to do.
0 Kudos
Message 6 of 7
(5,559 Views)

Thanks Centerbolt

My files are quite big to email, but I will see if I can come up with something to send. In essence the problem involves plotting a spectrum of 4000points between say zero and 100MHz (on the X axis), and on the same graph plotting the limit line which is defined only from 30Mhz to 100MHz. The 3 columns of data come through from labview together( freq,spectrum,limit-line), with the limit line column showing zeros from 0-30MHz. At present excel plots all the zeros in the limit line column as well, whereas I only want it to show the line from 30-100MHz.

Perhaps I need to separate the limit line column from matching every frequency step of the spectrum data, and send it through to the excel sheet separately as a pair of columns specifying frequency and limit line amplitude only over the required (30-100MHz ) range defined- so that it can plot independently on the XY scatter plot.

I was trying to avoid having to go to this length by just having excel plot only non-zero values.

0 Kudos
Message 7 of 7
(5,543 Views)