Features, discussions, tips, tricks, questions, problems and feedback

Adroit Excel Reporting

Adroit supports excel reporting via a publishexcel.bas script file. This file can be found in the Adroit Additional Components install.
Here are the steps:
1.Copy the script file to your Project Folder\Script\ folder.
2.Now we go to Excel and create the report.

In the cells you want to display the values from Adroit, type in Adroit.{tagname}.{slot}. In the example above I used the SystemInfo agent and the second, minute and hour slots. Save this file as an .xls to any location. Make sure you remember the filename and location you saved it in. You will need it later.

3.Now go to your Agent Configurator and create a script agent. In the Modules window, select the publishexcel.bas file. Make sure to untick the “Exclude path from file name”.
In the Main Subroutine click on the browse button next to the textbox. Now you should see different functions available from this script. We are going to use the “AdrProduceExcelReport” function.

It should look like this now:

4.The next step is to specify the excel report file and what functions you want from it. This will be true or false commands specified after the excel file. It is represented with comma’s after the filename with either 1 or 0. See example later.

'AppVisible : True if you want the Excel application window to be visible to the user
'ReadOnly : True if you want the Excel worksheet file specified in the XLSfile parameter to open in read-only mode
'PrintXLSfile : True if you want to print the Excel worksheet
'CloseWhenFinished : True if you want to close the worksheet when this script has finished

Here is the example command.

AdrProduceExcelReport C:\ProgramData\Adroit Technologies\Adroit\Configurations\1MAPS Project\Script\Excel Sample Report.xls,1,0,0,0

C:\ProgramData\Adroit Technologies\Adroit\Configurations\1MAPS Project\Script\Excel Sample Report.xls - is the filename and location.

,1 - AppVisible. I want to see that Excel opens with the values in it.

,0 - ReadOnly. I don’t want the file to be a Read Only.

,0 - PrintXLSfile. I don’t want the Excel to be printed automatically to my default printer.

,0 - CloseWhenFinished. I don’t want the Excel file to close automatically after populating with values and/or after printing it.

5.Click the Update button on the right of the window. Now you can run the script. Click on the button next to the Main Subroutine textbox. The excel file will now open and populate the cells you specified with Adroit tags.

6.You can now select to trigger the script either from a tag or every xx seconds.

1 Like

Hi,
Thanks for this share @Janhrust . I use it and it is perfect but I need also read something from excel file. So, is there a way to do it?

Thanks.
Murat.

Hi Murat,
Do You need to read something from excel file to MAPS Operator? Or do You need something from excel into this excel report?
If it’s the first case, check this example
It is a graphic form, where You can open excel xlsx file to datagridview and, after making changes to datagridview, save a new xlsx file using save button. Check the graphic form script, because there is a need of changing paths to excel files. This script requires microsoft excel to be installed on the same machine as MAPS Operator. You can later manage data being in datagridview and pass it to Agents using our standard data element scripting (also examples in this knowledge base).
Please remember that this is just example (made out of some sample code from stackoverflow.com vast number of C# examples) and You need to modify it and test it so it will work for Your needs.

1 Like