Quick overview
This workflow runs every Monday and reads bank balances and expected cash items from Google Sheets to calculate a 13-week cash flow forecast, update a Forecast tab, and send an HTML report via Gmail highlighting low-cash weeks, past-due items, and data issues.
How it works
- Runs every Monday at 7:00 AM based on the schedule trigger.
- Loads the Google Sheets URL, email recipient, minimum cash balance, currency code, and company name used for the report.
- Reads the latest bank balance from the “Bank Balance” tab and all expected inflow/outflow items from the “Cash Items” tab in Google Sheets.
- Calculates a 13-week (Monday–Sunday) forecast by expanding recurring items, rolling past-due one-off items into week 1, and computing weekly opening/closing balances while flagging weeks below the minimum cash level.
- Writes the weekly forecast rows back to the “Forecast” tab in Google Sheets by matching on the Week value (W01–W13).
- Builds an HTML email summary (including warnings, a 13-week table, and the largest upcoming items) and sends it to the configured recipient using Gmail.
Setup
- Create a Google Sheet with tabs named “Bank Balance”, “Cash Items”, and “Forecast”, using headers that match the fields referenced in the workflow (for example: Bank Balance: Date, Balance; Cash Items: Type, Category, Description, Amount, Expected Date, Repeat).
- Add Google Sheets OAuth credentials in n8n and replace the spreadsheet URL plus company/currency/minimum cash/recipient values in the forecast settings.
- Add a Gmail OAuth credential for the account that sends the email report.
- Populate the Bank Balance tab with at least one valid Date and Balance row, and add Cash Items with Type (Inflow/Outflow), Amount, Expected Date, and optional Repeat values (blank/Weekly/Biweekly/Monthly/Quarterly).