SQL Server query to Excel on a schedule
“send the results of our sql server open purchase orders query to an excel file every morning, one row per supplier with open order value and the oldest order, and flag orders past their promised date, orders with no supplier, and lines with a quantity of zero”
Send the results of our SQL Server dbo.PurchaseOrderLines query to an excel file every morning, one row per supplier with open order value and the oldest order, and flag orders past their promised date, orders with no supplier, and lines with a quantity of zero.
What the agent built
1 step, each one an ordinary Mammoth step you can open and change.
- FileSQL Server dbo.PurchaseOrderLinesCSV export · 44 rows
- StepSummarize supplier ordersStep 1
- ResultOpen Purchase Order Flags14 rows
- ScheduleRuns every morningProposed
On the sample files, every step runs and the result has 14 rows.
- Download SQL Server dbo.PurchaseOrderLines sample (44 rows)SQL Server: open the query in SSMS and export the result grid to Excel
What you get back
The result of that run, the rows to look at first.
| Supplier | Open order value | Oldest order | Past-due order lines | Lines with no supplier | Zero-quantity lines |
|---|---|---|---|---|---|
| Summit Tooling | 5,290 | 2026-10-02 | 4 | 0 | 0 |
| Bluepeak Metals | 3,372.85 | 2026-10-09 | 2 | 0 | 0 |
| Crescent MRO | 348.75 | 2026-10-14 | 2 | 0 | 0 |
| Riverton Fasteners | 182 | 2026-09-24 | 2 | 0 | 0 |
| Harbor Electrical | 1,518.80 | 2026-10-05 | 1 | 0 | 1 |
| Monarch Gaskets | 82.50 | 2026-10-20 | 1 | 0 | 1 |
| (no supplier) | 2,221.80 | 2026-09-29 | 0 | 4 | 0 |
| Pinecrest Packaging | 897 | 2026-10-07 | 0 | 0 | 1 |
| Aster Industrial Supply | 1,174.10 | 2026-10-12 | 0 | 0 | 0 |
| Delta Bearings | 391.20 | 2026-10-27 | 0 | 0 | 0 |
| Evergreen Plastics | 1,716 | 2026-10-17 | 0 | 0 | 0 |
| Ironclad Bearings | 626.25 | 2026-10-22 | 0 | 0 | 0 |
How it works
How to use the Open Purchase Order Flags 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.
Open Purchase Order Flags: questions
How do you send SQL Server purchase orders to Excel on a schedule?
What export should you use from SQL Server?
What happens to rows that do not match a rule?
How do you change the rules later?
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
Remove duplicates, tidy names and addresses, fill the blanks, and merge files into one.
- 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
- Merge Excel or CSV filesOne tidy table with every file's rows, re-sent rows dropped, and a Period columnSee the workflow Template
- Remove duplicatesOne row of each, with a Copies column saying how many there wereSee the workflow Template
- Remove blank rowsRemove rows that are empty or only contain spaces from an Excel export, while keeping the rest of the sheet unchanged.See the workflow Built by the agent
- Match names to a master listEach record with its master name (and ID), and how it matchedSee the workflow Template
- Multi-entity consolidationEvery entity's balances in one currency, by accountSee the workflow Template