Daily ERPNext business health snapshot in Google Sheets

Every weekday at 6am, add one dated row of your open orders, overdue invoices, and low stock to a Sheet so you can chart the trend.

Deterministic Code
ERPNextGoogle SheetsOperationsFinanceData Sync
PromptCreate

Every weekday at 6am in my business timezone, take a snapshot of my ERPNext business health and append it as a single dated row to a KPI tracker tab in a Google Sheet. Use a cron trigger, Monday through Friday. This is a pure snapshot job: no notifications, no commentary, no ranking or interpretation of the numbers.

The row always has these eight columns, in exactly this order: Date, Open Sales Orders, Open SO Value, Overdue Invoices, Overdue Outstanding, POs Awaiting Receipt, PO Value Awaiting Receipt, Items Below Reorder Level.

Open sales orders: use ERPNext Get Document Count (frappe.client.get_count) on the Sales Order DocType filtered to docstatus = 1 with status not in Closed, Completed, or Cancelled. Then use List Documents on Sales Order with those same filters, requesting base_grand_total, and sum it for the value column. Always use the company-currency base amounts so a multi-currency order does not distort the trend line.

Overdue sales invoices: filter Sales Invoice to docstatus = 1, outstanding_amount > 0, and due_date earlier than today. Count them with Get Document Count and sum outstanding_amount, not grand_total, via List Documents using the identical filters so the count and the value always agree.

Purchase orders submitted but not yet received: filter Purchase Order to docstatus = 1, per_received < 100, and status not in Closed, Completed, or Cancelled. Count with Get Document Count and sum base_grand_total with List Documents on the same filters.

Items below reorder level: read the item reorder rules with List Documents against the Item Reorder child table of Item (pass the parent DocType when the API requires it), pulling item_code, warehouse, and warehouse_reorder_level for every item that has a reorder level configured. For each one, call Get Stock Balance (erpnext.stock.utils.get_stock_balance) for that item and warehouse, and count how many have a balance strictly below their reorder level. Count each item and warehouse pair once. If reorder rules cannot be read as a child table on this instance, fall back to List Documents on Item and use the reorder level recorded there. Cap the check at the first 500 reorder rules so the run stays fast.

Important pagination detail: ERPNext list calls return only 20 rows by default. When summing values, page through with limit_start and limit_page_length, or pass limit_page_length = 0, so the totals cover every matching document rather than just the first page. A silently truncated sum is the main way this workflow can go wrong.

Write the row with Google Sheets Append Values into the KPI tracker tab, using valueInputOption USER_ENTERED so the date lands as a real date and the figures land as real numbers that charts and pivot tables can read directly. Format the date as YYYY-MM-DD. Write 0 rather than leaving a blank when a figure legitimately comes back empty, so the series has no holes. If the tab is empty on the first run, write the header row before the first data row.

Before appending, read the existing date column with Get Values and skip the append if today's date is already present, so a re-run never double-writes a day. If any ERPNext call fails, do not append a partial row: fail the run instead, so each day is either fully recorded or not recorded at all.

The column set is fixed. Once the sheet has history, columns must never be reordered or renamed, because everything built on top of the sheet reads by position. If I ask for more figures later, add them as new columns on the right and leave the existing ones exactly where they are.

Example output

Date | Open Sales Orders | Open SO Value | Overdue Invoices | Overdue Outstanding | POs Awaiting Receipt | PO Value Awaiting Receipt | Items Below Reorder Level 2026-08-03 | 34 | 176450.00 | 11 | 42980.55 | 8 | 69200.00 | 12 2026-08-04 | 37 | 184920.00 | 12 | 46310.55 | 9 | 72480.00 | 14

Additional information

What does this prompt do?
  • Checks your ERPNext account every weekday morning and works out the handful of numbers that show how the business is actually doing right now.
  • Records open sales orders and what they are worth, overdue customer invoices and how much is still unpaid, purchase orders you have committed to but not yet received, and how many products have fallen below their reorder point.
  • Adds all of it as a single dated row in a tracker tab in your Google Sheet, using the same columns in the same order every day.
  • Builds a clean history you can chart or pivot, so you can watch cash tied up in orders and stock risk move over weeks and months instead of only seeing today.
What do I need to use this?
  • An ERPNext account with permission to view sales orders, sales invoices, purchase orders, and stock levels
  • A Google account and a spreadsheet with a tab set aside for the KPI tracker
  • Reorder points already set in ERPNext on the products you want watched
How can I customize it?
  • Change the timing, for example running it every day including weekends, or switching to a single Monday morning snapshot.
  • Add or remove figures before you start collecting history, such as splitting order values by branch or limiting the stock check to one warehouse.
  • Point it at a different spreadsheet or tracker tab if you keep separate books per company.

FAQs

Will this overwrite yesterday's numbers?
No. Each run adds a new row underneath the last one, so your history keeps growing and nothing already written is touched.
Can I add more figures later?
Yes, but always add them as new columns on the right. Charts and pivot tables read your history by column position, so renaming or reordering existing columns would break every chart built on the older rows.
Does this work with a self-hosted ERPNext?
Yes. It works with ERPNext Cloud or your own server, as long as the site is reachable and you have a login with permission to view sales, purchasing, and stock records.
What happens on a quiet day with no activity?
It still writes a row, using zero for any figure that came back empty. That keeps the time series continuous so your charts do not show misleading gaps.
Do I need to set the spreadsheet up first?
Only a blank tab. The first run writes the header row for you, and every run after that just appends the day's figures underneath.

Related templates

Flag at-risk students in Canvas before they fall behind

Every weekday at 7am, your active courses are checked for missing work, silent logins, and slipping grades, with a ranked list sent to your advising channel.

Canvas
Google Sheets
Slack Bot
Agentic Task
Weekly Canvas grading backlog report in Slack and Sheets

Every Monday at 8am, see exactly which assignments have work waiting, sorted worst first, posted to Slack and logged to a spreadsheet.

Canvas
Slack Bot
Google Sheets
Deterministic Code
Weekday early alert digest for at-risk students in Slack

Every weekday morning your advising team gets a ranked list of students slipping behind in each course, plus a tracking log that shows whether outreach worked.

Blackboard
Slack Bot
Google Sheets
Agentic Task
Chase overdue ERPNext invoices with escalating reminders

Every weekday morning, review your unpaid ERPNext invoices, email each customer a reminder that gets firmer as the debt ages, and brief finance in Slack.

ERPNext
Gmail
Slack
Agentic Task
Weekly service desk scorecard with a running trend history

Every Monday at 8am, count last week's tickets and SLA results, add one row to a tracking sheet, and post the headlines to Slack.

Jira Service Management
Google Sheets
Slack
Deterministic Code
Weekly stock replenishment brief from ERPNext to Slack

Every Monday at 7am, find out which items will run out before your supplier can deliver, with draft restock requests waiting for approval.

ERPNext
Slack Bot
Agentic Task

Stop rebuilding the same ERPNext report every morning.

Let the snapshot run itself and watch your cash and stock trends build up in a spreadsheet you already know how to use.