Monthly data files saved and prepared on their own
- Problem
- Every month the ODR report files arrived by email, and someone had to download, rename, find the right folder and clean up the sheets before closing.
- Solution
- A flow that takes only the Excel file from the email, saves it to the previous month's SharePoint folder with a standard name and runs an Office Script that gets the file ready for the dashboard.
- Result
- The file is in the right place as soon as the email arrives, in the same format every month. The same pattern became a second flow, for the R&D TOP 20 file.
What I learned
The file reached SharePoint empty because the flow saved only the attachment name. The fix was to save the content, converted from base64. And the folder is calculated from the date, so the flow needs no monthly changes.
// previous month, for the folder and the file name formatDateTime(addDays(startOfMonth(utcNow()), -1), 'MM') // the attachment content, not just its name base64ToBinary(items('Apply_to_each')?['contentBytes'])