Lab · At work · iBuy / 6ave.com
Sales-report flows
Power Automate flows that file every hourly and daily sales report into Google Drive the moment it lands, where the internal dashboard reads it automatically.
- Status
- In production
- Who uses it
- The team that uses PublishOS’s sales and profit views.
- Built with
- Power Automate · Google Drive API (service account) · Node.js on Render · Upstash Redis
Fix the pipe, not the parser
Before
Now
Nothing counted twice Example files
- Imported_Hourly file↩ already read · remembered 30 days
- report file → done_report file→ deleted by the owner-side cleanup flow
The problem
Sales reports arrive by email. The email service the dashboard relied on started rejecting large messages, so reports stopped arriving and the sales history went dark. They needed a path with no size limit, without changing the data the dashboard already trusted.
How it works
Email → Drive
A flow saves each report as a file in a Drive folder, and keeps an archive copy.
Polled every 15 minutes
The server checks the folder with its own service account.
Same parser as before
Each new file goes through the parser the email route used, so the data’s shape didn’t change.
Nothing counted twice
Files already read are remembered for 30 days, and order rows are de-duplicated by content, so overlapping hourly and daily reports don’t double-count.
Self-cleaning
Read files are marked done, and a daily cleanup flow removes them along with anything older than three days.
History rebuilt
A one-off backfill flow re-filed past reports to restore the history, then was switched off.
Guardrails
Read-only
The process only reads the folder and tidies files it has already read.
Keys server-side
The service-account key lives in server settings only, and the status and manual-run controls need a token.
Engineering notes
Fix the pipe, not the parser
One parser kept, only the delivery path changed, so nothing downstream had to change.
Drive permissions
Drive won’t let a non-owner delete files, so the server renames them done and a small owner-side flow does the final delete.
Memory-safe backlogs
After one large backlog ran the server out of memory, each run was capped and progress is saved after every file.
Columns by name
The parser maps columns by header name, so a new report column no longer shifts the data.