Forecast stockouts and draft purchase orders with Gemini, Sheets, Slack and Gmail

Go to Workflow
0 views
Built by Oka Hironobu Oka Hironobu
Created on August 11, 2026

Description

Quick Overview
This workflow runs every morning to read inventory from Google Sheets, calculate days of cover and reorder suggestions, and use Google Gemini to draft a purchase recommendation. It alerts Slack and creates Gmail drafts for stockout risks, emails the buyer for low stock, and writes status fields back to Sheets.

How it works
Runs daily at 7:00 to start an inventory check.
Reads the Inventory sheet from Google Sheets.
Calculates daily sales velocity, days of cover, a lead-time-based reorder point, and a suggested order quantity, and skips items alerted in the last three days.
Uses Google Gemini to generate a short, plain-language purchase recommendation for each item that needs attention.
Routes items by status, sending stockout risks to Slack and drafting a supplier purchase-order email in Gmail.
Emails the buyer for low-stock items using the generated recommendation text.
Appends or updates the Inventory sheet in Google Sheets with the latest cover, reorder point, suggested quantity, and status.

Setup
Connect credentials for Google Sheets, Google Gemini (PaLM) API, Gmail, and Slack.
In Google Sheets, create/select an Inventory sheet with columns: SKU, Product, Stock On Hand, Weekly Sales, Lead Time Days, Unit Cost, Supplier, Supplier Email, and Last Alert.
Select the correct spreadsheet and sheet in the Google Sheets nodes, choose the target Slack channel, and update the buyer email address in the Gmail low-stock email action.

Nodes Used (6)

Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm
Code
n8n-nodes-base.code
Gmail
n8n-nodes-base.gmail
Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini
Google Sheets
n8n-nodes-base.googleSheets
Slack
n8n-nodes-base.slack