Quick overview
This workflow runs weekly (or manually) to audit SaaS spend by combining corporate card CSVs from Google Drive, invoice/receipt emails from Gmail parsed with OpenAI, and a SaaS inventory in Google Sheets, then flags potential waste and sends a savings report to Google Sheets, email, and Slack.
How it works
- Runs on a manual trigger or every Monday at 9 AM and loads configuration values like folder IDs, Google Sheet ID, thresholds, report email, and Slack channel.
- Pulls corporate card statement CSV files from Google Drive, downloads them, parses the rows, and normalizes transactions into a consistent charge format.
- Fetches recent invoice and receipt emails from Gmail, batches them, and uses OpenAI (gpt-4o-mini) to extract structured SaaS invoice line items.
- Reads the “SaaS Inventory” tab from Google Sheets and merges it with the card charges and extracted invoice data.
- Cross-references all sources to detect issues such as zombie charges, duplicate charges, unused tools, seat waste, price increases, overlapping tools, and shadow subscriptions, and calculates potential monthly and annual savings.
- If leaks are found, OpenAI (gpt-4o-mini) generates a prioritized cancellation/optimization plan and the workflow logs findings to Google Sheets, emails an HTML report via Gmail, and posts a summary to Slack.
- If no leaks are found, the workflow ends without sending any reports.
Setup
- Add Google Drive OAuth2 credentials and set the statements folder ID in the configuration so the workflow can find and download your card-statement CSVs.
- Add Gmail OAuth2 credentials and confirm the Gmail search query plus the finance report recipient address used for fetching invoices and sending the report.
- Add an OpenAI API credential to enable invoice extraction and the cancellation/optimization plan generation.
- Add Google Sheets OAuth2 credentials and set the Google Sheet ID, ensuring it contains a “SaaS Inventory” tab for input and a “Leak Report” tab for appended findings.
- Add Slack OAuth2 credentials and set the target Slack channel name in the configuration for posting the alert.
- Review and adjust configuration thresholds (for example, unusedDays, minSeatUtilization, currency, dateFormat, and debitsAreNegative) to match your data and reporting needs.