Workflow · Calculate · Opening soon
Postgres query to Google Sheets on a schedule, with checks
Export the orders query from PostgreSQL, then load it into a spreadsheet workflow and group paid orders by day and channel. Add rules to flag days with no orders, rows with negative amounts, and rows with no channel, then send the finished summary to Google Sheets on a schedule.
Someone typed
“from our postgres orders, show day and channel with orders, revenue, aov, and status; count only paid orders, add 2026-10-17 as no orders, and flag negative amount or no channel”
The agent read it as
From Postgres orders table, show day and channel with orders, revenue, aov, and status; count only paid orders, add 2026-10-17 as no orders, and flag negative amount or no channel
What the agent built
1 step, each one an ordinary Mammoth step you can open and change.
File
Postgres orders table
CSV export · 45 rows
Step
Summarize paid orders by day and channel
Step 1
Result
Daily Channel Orders
42 rows · 8 flagged
Schedule
Runs when you say
Proposed
- FilePostgres orders tableCSV export · 45 rows
- StepSummarize paid orders by day and channelStep 1
- ResultDaily Channel Orders42 rows · 8 flagged
- ScheduleRuns when you sayProposed
On the sample files, every step runs and the result has 42 rows.
- Download Postgres orders table sample (45 rows)PostgreSQL: Query Tool > Run SQL > Export results
What you get back
The result of that run, the rows to look at first.
Daily Channel OrdersSample data42 rows
34 agrees7 no channel1 no orders
| Day | Channel | Orders | Revenue (USD) | AOV (USD) | Status |
|---|---|---|---|---|---|
| 2026-10-03 | · | 1 | 72 | 72 | No channel |
| 2026-10-06 | · | 1 | 32.10 | 32.10 | No channel |
| 2026-10-09 | · | 1 | 67.25 | 67.25 | No channel |
| 2026-10-13 | · | 1 | 105 | 105 | No channel |
| 2026-10-19 | · | 1 | 38.80 | 38.80 | No channel |
| 2026-10-21 | · | 1 | 59.50 | 59.50 | No channel |
| 2026-10-26 | · | 1 | 64.20 | 64.20 | No channel |
| 2026-10-17 | · | 0 | 0 | · | No orders |
| 2026-10-01 | app | 1 | 36 | 36 | Agrees |
| 2026-10-01 | web | 1 | 84.50 | 84.50 | Agrees |
| 2026-10-02 | marketplace | 1 | 129.99 | 129.99 | Agrees |
| 2026-10-02 | web | 1 | 58.25 | 58.25 | Agrees |
How it works
How to use the Daily Channel Orders workflow
- 1Get early accessWe invite people in small batches, job by job. You'll land on this workflow, already built and working on sample files.
- 2Swap in your exportsUpload your own files as they come out of your tools. The agent checks the workflow on your rows.
- 3Change it in words, then turn it onSay what to change and see the new result before anything saves. Then choose when it runs.
Daily Channel Orders: questions
How do you run a Postgres query to Google Sheets on a schedule?
Export the orders query from PostgreSQL, then load it into a spreadsheet workflow and group paid orders by day and channel. Add rules to flag days with no orders, rows with negative amounts, and rows with no channel, then send the finished summary to Google Sheets on a schedule.
What export should I use from PostgreSQL?
Use the exported query result from PostgreSQL, usually a CSV or another spreadsheet-readable file. The file should include the columns you need for the summary, such as order date, channel, amount, and payment status.
What happens to rows that do not match a rule?
Rows that do not match a rule stay out of that grouped result, unless you add a separate check for them. You can still flag them, label them, or keep them in a review step before the file is sent to Google Sheets.
How do I change the rules later?
Edit the rules in plain words, then run the workflow again on the next export. You can change which rows count, what gets flagged, and which status each row gets without changing the source file format.
Get early access to this workflow
It opens already built and working on sample files. Swap in your own exports to see your result.
Workflows like this
Schedules, commissions, costing and margins, worked out the same way from every new export.
- Pivot table from raw dataTurn a raw sales export into a pivot table of revenue by region and month.See the workflow Built by the agent
- Real estate commission splitWork out real estate commission on each closed sale and split it between the listing agent, buying agent and brokerage.See the workflow Built by the agent
- Loan amortization from statementsBuild a monthly loan amortization schedule from an Excel export, with interest, principal, and remaining balance for each loan.See the workflow Built by the agent
- Accrued expenses scheduleBuild an accrued expenses schedule from QuickBooks exports. Match purchase orders to vendor bills, calculate unbilled amounts, and flag items that need accrual.See the workflow Built by the agent
- RFM segmentsEvery customer scored 1-5 on recency, frequency and spend, with a segmentSee the workflow Template
- Sales velocityEach rep's open deals, win rate, deal size, sales cycle and velocity, and the team'sSee the workflow Template