03-22-2024 06:37 AM
Use Case: Send a weekly report of SharePoint list information to specific users
SharePoint List:
Column Name | Data Type |
First Name | Single line of Text |
Last Name | Single line of Text |
OrderNo | Number |
Product | Single line of Text |
Quantity | Number |
OrderTotal | Number |
OrderStatus | Single line of Text |
OrderDate | Date and Time |
Weekly Report:
Prepared a spread sheet (Excel file with extension .xlsx) with all the required columns with sample data and formatted as an excel table. Now, stored the excel file in the Documents library.
Flow at high level view (collapsed view):
Used "Scope" action to consolidate actions as sections for easy understanding. Also, we can use exception handling easily with Scopes.
Here is the details view of the flow:
Step 1: Flow Trigger
The flow trigger is a recurrence schedule. The flow runs on every Sunday morning (only once in a week)
Step 2: Get product orders created from last 7 days
The above action "Get Items" will retrieve all the product orders which were created from last 7 days from today.
Filter Query:
OrderDate gt 'addDays(utcNow(),-7)'
Note: Insert the above expression from expression pop up dialog box.
Step 3: Clean Weekly Report Spreadsheet in the document library
In this step, performing following steps:
1. Accessing the Excel table by using "List rows present in a table" action.
2. Checking if the table has any rows with following expression:
length(body('List_rows_present_in_a_table')?['value']) is not equal to 0
3. Deleting each row from excel table.
Step 4: Generate Weekly Report
Now, adding every single product order item which I received with Get Items action to the spread sheet. Mapped the columns in the spread sheet with the columns in the SharePoint list Product Orders.
Step 5: Send email with weekly status report as attachment
By using "Get file content" action, I am getting the weekly spread sheet content and sent it as an attachment to the specific users.
Important Note:
Attachments Name - 1 field in the above screen shot contains the file name. We MUST include file extension as .xlsx. Otherwise, the flow will send the email with attachment with no extension.
I hope the above post will help to address your requirement.
Regards
Krishna Rachakonda
watch?v=9nS_TwlvXNI
Hi,
I have created flow for Power Bi tables using power automate, in which on click it will send table in csv format as attachment to intended receiver.
Here i want one help, i have many rows in table but i want summary (or can say pivot on first level) of that table in the mail body, i tried to mentioned by SELECT option but each row is getting in mail body.
Can you please help.
If you or anyone else have a much larger report to automate like this, you may want to check out the new Excel batch actions I created:
Excel batch update, create, & upsert:
Demo video:
Excel batch delete:
https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Excel-Batch-Delete/m-p/1634375#M735
If you or anyone else have a much larger report to automate like this, you may want to check out the new Excel batch actions I created:
Excel batch update, create, & upsert:
Demo video:
Excel batch delete:
https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Excel-Batch-Delete/m-p/1634375#M735
Hi,
Thank you explanation. But why not mentioned "Delay" used in "Step 4: Generate Weekly Report" . it's also very important for this automate for in case of SharePoint data was big.
anyway i took two day for find this mistake in my automate lol.....
Thank you for the vlog. It was very helpful.
I have a question and hopeful you can help. So the data that I am pulling, sometimes is not update within a week time. How can I add a condition that if the new excel file has no data this week. The stakeholders does not receive an email (prefer no email option) or send a different email stating that no updates were made this past week?
This tutorial was great. It helped me create a report.
However, there appears to be an issue when I try and open the file. I always get a message that the file is corrupt. I tried other options like base64 but it did not succeed. Not sure where the issue lies.
Any suggestions?