Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW

Using Qlik Application Automation to create and distribute Excel reports in Office 365

100% helpful (2/2)
cancel
Showing results for 
Search instead for 
Did you mean: 
MattGrayndler
Employee
Employee

Using Qlik Application Automation to create and distribute Excel reports in Office 365

Last Update:

Jun 26, 2023 3:26:33 AM

Updated By:

Sonja_Bauernfeind

Created date:

Oct 15, 2021 12:34:34 AM

Attachments

With Qlik Application Automation, you can get data out of Qlik Cloud and distributing it to different users in formatted Excel. The workflow can be automated by leveraging the connectors for Office 365, specifically Microsoft SharePoint and Microsoft Excel. 

Here I share two example Qlik Application Automation workspaces that you can use and modify to suit your requirements. 

Content:

 

QAA_O365_Excel_Sharepoint_Report_EmailEG.pngQAA_O365_Excel_Sharepoint_Report_ReportEG.png

Video:


 

Considerations

  • This example is built on distributing a SharePoint link. It is also possible to use attachments with the Mail block (see Creating a Qlik Reporting Service report).
  • Qlik Application Automation has a limit of 100,000 rows when getting data out of a Qlik Sense straight table object.
  • The On-Demand example uses an extension in QSE SaaS to send data to the Automation. An update to the Qlik Sense Button object is expected soon, which will provide a native way to pass selections to an Automation.

 

Example 1: Scheduled Reports

  1. Download the 'Scheduled Report.json' file attached to this document.
  2. Create a new Automation in QSE SaaS, give it a name, and then upload the workspace you just downloaded by right clicking in the editor canvas, and selecting 'Upload workspace'.
  3. Select the 'Create Binary File (Personal One Drive)' block, select 'Connection' in the block configurator to the right, and then create your connection to Microsoft SharePoint.
  4. Select the 'Get Straight Table Data' block. Under 'Inputs' in the block configurator, lookup your the App Id, Sheet Id, and Object Id for the relevant QSE SaaS table you wish to output.
  5. Select the 'Create Excel Table With Headers' block, select 'Connection' in the block configurator, and then create your connection to Microsoft Excel.
  6. Select the 'Send Mail' block. Under 'Inputs' in the block configurator update the 'To' to reflect the addresses you wish to deliver to.
  7. With the 'Send Mail' block still selected, select 'Connection' in the block configurator and add your Sender details.
  8. To test, Save and then Run the Automation
  9. If you receive any warnings or errors, navigate to the relevant blocks and ensure your Connection is selected in the block configurator. 
  10. Select the 'Start' block. Under 'Inputs' in the block configurator, change Run Mode to Scheduled and define your required schedule. 

 

Example 2: On-Demand Reports

Note - These instructions assume you have already created connections as required in Example 1.

  1. Download the 'On-Demand Report v3.json' file attached to this document.
  2. Download and install the 'qlik-blends' extension. See: 
    https://github.com/rileymd88/qlik-blends/files/6378232/qlik-blends.zip
  3. Create a new Automation in QSE SaaS, give it a name, and then upload the workspace you just downloaded by right-clicking in the editor canvas, and selecting 'Upload workspace'.
  4. Ensure your Connections are selected in the block configurator for each of the following blocks, 'Create Binary File (Personal One Drive)', 'Create Excel Table With Headers', 'Add Rows To Excel Worksheet Table (Batch)', 'Create Sharing Link', and 'Send Mail'.  Save the Automation.
  5. Select the 'Start' block and ensure Run Mode is set to Triggered. Make note of the of URL and Execution Token shown in the POST example. 
  6. Open your chosen QSE SaaS application, and Edit the Sheet where you wish to add a Button to trigger an On-Demand report. 
  7. Under 'Custom Objects' look for 'qlik-blends' from the Extensions menu and drag this into your Sheet.
  8. Under the 'Blend' properties to the right, add-in your POST webhook URL and Token as noted in Step 5.
  9. We will now add three measures to the 'qlik-blends' object. It is important you add them in the order described.  Add the first measure, using the following function in the expression editor: GetCurrentSelections()
  10. Add the second measure, using the following function DocumentName()
  11. The final measure will be the Object ID of the table you wish to use. To find the Object ID, select 'Done Editing'.  Then right click on the table, select 'Share', select 'Embed', then look for the Object ID under the preview. Copy this value, go back into Editing mode and paste this as your third measure value. 
  12. With the 'qlik-blends' object selected, under Form select 'Add items'. For 'Item type' select Text. Under default value you can choose to add a default email address. For 'Label' and 'Reference'  type 'Email'. It is critical that Reference is updated to 'Email'.  Turn 'Required input' on. 
  13. You can change the Appearance properties to suit your preferences, such as updating the Button label and message, enabling Dialog, and changing the Color under Theme.
  14. Back in the Automation, under the Start Block. Set  'Run asynchronously' = yes to allow multiple requests to run at the same time (This will also increase the max run time from 1min to 60min)
  15. Once happy, test the On-Demand report by entering an email and clicking the button.

This On-Demand Report Automation can be used across multiple apps and tables.  Simply copy the extension object between apps & sheets, and update the Object ID (Measure 3) for each instance. 

 

Environment

 

The information in this article is provided as-is and to be used at own discretion. Depending on tool(s) used, customization(s), and/or other factors ongoing support on the solution below may not be provided by Qlik Support.

 

Labels (1)
Comments
MattGrayndler
Employee
Employee

Hi @jmcy2408 ,

I'm sure there was a nicer way to do this, but I crudely made a mapping table to support up to 26 columns (column Z) as you've discovered. This can be extended as you have done. 

 

martinamangiagli
Contributor II
Contributor II

Hi @MattGrayndler,
I tested your app and it works perfectly but i need to replace the logo both in the email and in the excel's heather.
Where can I make these changes?

MattGrayndler
Employee
Employee

Hi @martinamangiagli ,

The templates I created for the Excel and Email are just examples, and can be updated to suit your needs. 

The block 'Variable - templatebase64' contains the Excel template in Base64 format.   You can copy the base64 data and use an online converter to convert it back into a file (make the relevant changes) and then convert it back into base64 and update the data in the block. 

QAA has the ability to convert files to base64, so if you think you might need to make changes to the template often, you can modify the workflow to read the file from external storage and use the 'Base64 encode' formula.  I pasted the base64 data directly in a variable so that the template was more easily portable to share. 

 

For the email, again I've directly included the image data in the template in base64 format.

"<img width="161" height="47" src="data&colon;image/png;base64,iVBORw0...."

You can replace the data that appears after 'base64,' to me your logo converted to base64. And can update the width and height  values to match the correct size.  

The entire email template can be updated to suit your branding and needs. 

 

 

 

 

TaMahdi
Contributor III
Contributor III

Thanks @MattGrayndler for the informative blog,

I used Scheduled report and when I try to lookup for a sheet ID, it shows no items found, any possible reason for that?Auto.PNG

MattGrayndler
Employee
Employee

If anyone is experiencing issues in using the 'Create Binary File (Personal OneDrive)' block and are receiving a 401 error - please refer to:

https://docs.microsoft.com/en-us/sharepoint/troubleshoot/lists-and-libraries/401-error-when-using-gr...

TaMahdi
Contributor III
Contributor III

Thanks @MattGrayndler 

When using Get Straight Table Data, any possible reasons why the table generated from Qliksense is empty?

 

Sonja_Bauernfeind
Digital Support
Digital Support

Hello @TaMahdi 

For further and in-depth troubleshooting assistance, I would recommend you reach out to our larger community by posting about your issue on the Qlik Automation forums.

All the best,
Sonja 

agigliotti
Partner - Champion
Partner - Champion

Hi @MattGrayndler ,

I followed every step to test the Example 1 - Scheduled Reports.

Unfortunately the table rows from Qlik Sense straight table have not been added to the excel table.

It seems the block "Microsoft Excel - Add Rows to Table (Batch)" does not works as expected.

I get the below table with only headers!!!

agigliotti_0-1652880961591.png

Could someone help me to fix it?
Many thanks in advance for your collaboration.

Best Regards

dudleytmc
Contributor
Contributor

@agigliotti I am having the exact same issue right now.  I believe there must be a limit on how many rows you can add at a time in that block.  I created a separate loop and was adding them in 20 row batches and it would work, but unfortunately, the block isn't smart enough to append the new rows to the bottom of the table and instead just overwrites the same 20 rows each time.

MattGrayndler
Employee
Employee

Hi @dudleytmc & @agigliotti -  I have re-tried this automation and am not facing the issue you are both seeing. 

If you look at the history of the 'Get Straight Table Data' block, do you see items in the output?

MattGrayndler_0-1652925835254.png

If you do not, how big is the table?  

Version history
Last update:
‎2023-06-26 03:26 AM
Updated by: