Quick Overview
This workflow runs every Monday to read supplier, transaction, and target data from Google Sheets, calculates supplier diversity and ESG spend performance, generates rebalancing recommendations with Groq when targets are missed, then publishes a scorecard to Notion and emails a weekly briefing via Gmail.
How it works
- Runs every Monday on a schedule trigger.
- Pulls supplier master data, procurement transactions, and target thresholds from Google Sheets.
- Normalizes and joins transactions to suppliers, then calculates total spend plus diverse, women-owned, minority-owned, and ESG-qualified spend versus the configured targets.
- If all targets are met or there is no qualifying spend data, it generates an executive summary with Groq and skips rebalancing.
- If any target is missed, it identifies category gaps and qualified low-risk diverse suppliers, asks Groq to propose FROM → TO spend shifts, and validates/caps the recommendations against ESG, risk, and rebalancing limits.
- Creates a Notion database page with the weekly scorecard and sends a formatted HTML briefing email via Gmail (including a link to the Notion page when available).
Setup
- Add Google Sheets credentials and set the Spreadsheet ID and sheet/tab names (Suppliers, Transcations, Targets) in the configuration values.
- Add Groq API credentials for both Groq chat model steps.
- Add Notion credentials, set the Notion database ID, and ensure the database properties/select options match the workflow outputs (e.g., ON_TRACK/NEEDS_ATTENTION/NO_DATA, MET/BELOW_TARGET, HIGH/MEDIUM/LOW, NONE/HUMAN_REVIEW).
- Add Gmail credentials and set the recipient email address used for the weekly briefing.
- Review the target metrics in the Targets sheet (or defaults in the code) and adjust the Monday run time in the schedule trigger if needed.