LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel Report Generation Error

Solved!
Go to solution

Hello

I am using Excel report generation toolkit to create a template report. Its a DAY report, in which the a SINGLE ROW will be added to existing/new report after every test, i.e. ever time the subvi executes, a single row will be added to the excel file 

 

My Issue

1. I am able to create the new excel file from the template and add the single line report, but whenever the vi executes, it throws an error while saving the excel file "Save report to File.vi" 

2. I have tried to use clear error vi to remove this error. But some how after some while, the report stops generating and a *.tmp file starts getting created

3. I have attached some reports generated

 

To test my code, in the cluster, change the "DAY REPORT TEMPLATE FILE" . Select browse button on the Path Control and choose "DAY_REPORT_TEMPLATE.xlsx" file

 

I am using LabVIEW 2020 SP1 32 bit and

Microsoft® Excel® 2021 MSO (Version 2410 Build 16.0.18129.20100) 64-bit

 

Kindly provide help on this issue.

 

0 Kudos
Message 1 of 11
(747 Views)

Sorry forgot to attach the project in earlier port

 

Project attached in this post

0 Kudos
Message 2 of 11
(745 Views)

I can't open your file but I'm going to assume this is your problem because it is a common issue.

If you haven't added NI_Excel.lvclass to your project or you haven't used an Excel-specific VI, the VI needed to save an Excel file is not loaded, even though you specify Report Type as Excel. 

 

No Excel-specific VI....

aputman_0-1731595695892.png

No Report to File for Excel.

aputman_1-1731595722275.png

 

Add Excel-specific VI....

aputman_2-1731595755991.png

Save Report to File for Excel is now available. 

aputman_3-1731595773514.png

 

 

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 3 of 11
(707 Views)

Hello

Thanks for the suggestion, but still the problem is not getting resolved

I have added "NI_Excel.lvclass" to my project and also the "Excel get activex reference vi" which you had suggested

 

The problem is that if I clear errors after excel File save, it sometimes works, but sometimes it creates a *.tmp files

The save excel throws error which is as follows

 

Exception occured in Microsoft Excel: Cannot access '14-11-2024.xlsx'.Help Path is xlmain11.chm and context 0 in NI_ReportGenerationToolkit.lvlib:Excel_Save_Workbook.vi->NI_Excel.lvclass:Save Report to File.vi->AUTO_UI_DAY_REPORT_TRIAL_SUBVI.vi

 

attached the project folder for the reference

 

0 Kudos
Message 4 of 11
(695 Views)

Try the suggestions in this thread:

https://forums.ni.com/t5/LabVIEW/tmp-file-is-created-by-NI-Report-generation-toolkit-for-logging/td-...

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 5 of 11
(690 Views)

Hello

I had gone through that post before I posted here. Somehow that points highlighted in that post is not applicable in my case.

 

The only thought I am having and if someone can through insight is, that could the problem arise, if I am using the same excel file over and over again?

 

My use case is that, in my test bench, I am getting results after every periodic test complete cycle. In a day I might have several testing cycles of DUT in the production line.

So I want to save the data in formatted condition to a file. So when the test completed, I append the new data to the same excel file.

Could this be a problem?

I could solve this by creating a *.csv file, but since the formatting is not applicable in csv format, the report does not look appealing.

 

Thanks 

0 Kudos
Message 6 of 11
(665 Views)

Hi I also just ran into this issue this week.  Curious if your company's IT department just implemented a requirement to add a "sensitivity label", seen in the capture below, onto Microsoft Office files (Word, Excel, etc.).  In my case, I cannot save a file unless I explicitely select an option from the dropdown.  There is no default and LabVIEW does not support setting this with a built-in VI (that I am aware of). I am thinking this is the route of my issue, which is the exact same as the OP's. 

sdepot_0-1731686392638.png

 

0 Kudos
Message 7 of 11
(646 Views)
Solution
Accepted by topic author VihangPatil

Your mention of using .csv files (perhaps generated using "Write Delimited Spreadsheet" may explain why you are having problems and how you might be able to "have your .slxs and add to it, too".

 

First, notice that to develop an "incrementing Delimited Spreadsheet" file requires nothing more than (a) using basic LabVIEW File I/O (using strings) and (b) a quick-and-easy way to close a file, reopen it, and quickly reposition to the end-of-file in order to continue additional data.

 

Now bring the RGT and Excel into the picture.  The RGT doesn't do the file I/O -- it instead passes data to Excel and instructs it how to format the data, then asks Excel to save the just-created file.

 

What you could do is to use the "Template" feature of the "Create Report" function.  Here's how you might do this:

  1. The first time you write to a Spreadsheet, use ordinary RGT commands.  When finished, "Save Report to File" (let's call it "My Data.xlsx") and then "Dispose Report" (which shuts down Excel, a process that might take a few hundred milliseconds -- you'll want a delay here.
  2. So now you want to add more data to this (now-existing) Excel Workbook.  How will you do this?  Will you make a new WorkSheet?  [There are RGT functions to help with this].  Are you going to use the same WorkSheet, perhaps adding new rows to the existing Sheet?  [There are also RGT functions to help with this].
    1. So now do a new "Create Report", but specifying the existing WorkBook as the Template.
    2. Add whatever data you want, either in a new WorkSheet or appending rows to the existing WorkSheet used before.
    3. Here, however, I'm uncertain whether or not "Save Report to File" will work if you specify the same filename as the "Template" you just opened.  If that doesn't work, you can always save to a temporary Report, close Excel (and wait for it to "let go" of the temporary .xlsx file), then rename the file to the name it had when originally opened two steps earlier.

I haven't actually tried this, but it should work (Famous Last Words).  Be sure to give Excel a "rest" between "Dispose Report" and the next "Create Report".

 

Bob Schor

Message 8 of 11
(612 Views)

Hello Bob,

Thanks for your suggestion

Since I am creating a new excel file everyday,  in the <Reports\Excel\Day Report> folder i.e. copying a template file from <root> folder and pasting it in the Reports folder, the "Save Report to File.vi" was causing the error as the template file and the saved file were the same.

So right now, the following workaround worked for me.

 

I have disabled "Save Report to File.vi" and used only "Dispose Report.vi" 

 

Therefore disabling the "Save Report to File.vi" which was creating an error is no longer required and the code works good as of now.

 

I think the second issue, i.e *.tmp file is probably because of long length i.e. filepath & filename put together, I will reduce the filepath on the clients side as well and check if it doesn't generate a *.tmp file.

 

Thanks all for your valuable suggestions.

0 Kudos
Message 9 of 11
(563 Views)

hello! sorry it's not related to the topic but I've followed several of your posts.
I'm working in labview with an emg signal, and I want to decompose it into motor units (muaps). I don't know if I need filters or how I could. Can you give me an idea, please? Thank you very much!

0 Kudos
Message 10 of 11
(540 Views)