Consider the scenario – you have a list of items in SharePoint and you’d like to export items created in the last 7 days to an Excel file in SharePoint – and then email the Excel file to someone.
Here are the steps:
- Create a blank flow and add a recurrence trigger. For testing I’m setting it to repeat every 7 minutes and this can be changed to suit your needs.
2. Clear existing rows from Excel table. The table is in the weeklyreport.xlsx file and the table name is table1 – it contains two columns, Title and CreatedDate. We’ll populate those columns from SharePoint. When selecting the actions use “Excel Business” since this file is stored in SharePoint.
3. Set your date filters for selecting items from the SharePoint list. You can search for date time in Flow and select the “subtract from time” option. The report start date is 7 minutes earlier than the current time. You can change the time unit after testing.
4. We’ll construct an Odata query to get items in the SharePoint list created in the last 7 minutes.
5. Select an apply to each action.
6. Get the new file and send the email
The complete flow: