This is Part 4 of the “Restaurant PO Automation” series. Part 3 produced five flat n8n items from one purchase order, each with keys named for a spreadsheet column. This post builds the destination: the Order_Lines sheet, its header, the credential sharing that makes the document visible to n8n, and the Append Row node that writes the first five rows.

Series guide: Restaurant Purchase Order Automation: Series Guide & Case Study

1. The sheet is the product, not a database

It is tempting to treat Google Sheets as a dumping ground for whatever the AI node happens to emit. That is the wrong framing. For this client, the spreadsheet is the deliverable. The warehouse opens it in the morning, filters it, and uses it to pick, pack and load. If the columns are wrong, the automation has failed even if every n8n node shows green.

So we design the header first, on paper, before configuring the last node. The question is not “what did the model return?” but “what does a warehouse picker need to see on a row?” A row has to answer: which order is this, which outlet is it for, when does it have to arrive, what exactly is the product, and how much of it, in which unit.

2. The eleven-column header

Create a workbook named Restaurant PO Automation - Demo and a first sheet named Order_Lines. Paste this single line into cell A1:

PO_Number | Order_Date | Delivery_Date | Brand | Outlet | Outlet_Code | SKU | Product | Category | Quantity | Unit

Sheets will split it into eleven columns automatically.

ColumnPurpose
PO_NumberThe order identifier; the natural key for tracing and, later, deduplication
Order_DateWhen the restaurant placed the order
Delivery_DateWhen the goods must arrive; the field every dispatch view filters on
BrandRestaurant brand, here the fictional Harbour Kitchen
OutletFull outlet name, e.g. Harbour Kitchen - Orchard
Outlet_CodeShort stable code, e.g. HK-ORC-01
SKUProduct code, e.g. VEG-001
ProductProduct description as written on the PO
CategoryProduce / Protein / Frozen / Dry Goods
QuantityNumeric amount, no unit text inside it
UnitKG, CTN, BAG, BTL

We keep both Outlet and Outlet_Code. The full name is what a human reads; the short code is what a QUERY formula groups by in Part 5 without worrying about spelling variants across outlets. Keeping Brand alongside Outlet costs one column and preserves the “same brand, different outlets” structure the client described.

The header names are not arbitrary. They are exactly the keys the Code node outputs. That identity is what lets the final node use automatic mapping instead of eleven manual drag-and-drop assignments.

3. Two rules that decide whether dispatch is correct

Most data-model mistakes in this kind of project are not technical; they are two quiet assumptions.

Delivery Date is not the date the email arrived. A restaurant may send an order today for tomorrow, the day after, or next week. In this demo, PO 01 and PO 02 are both delivered on 2026-11-23, while PO 03 and PO 04 are delivered on 2026-11-24. If we had stamped every row with the received date, the daily dispatch view would be wrong on half the orders. When a PDF contains no explicit delivery date, the correct behaviour is to mark it to be confirmed and route it to a human, not to default to same-day delivery.

Quantity must be stored together with its Unit. 10 KG, 10 CTN and 10 BAG are completely different physical amounts. Fresh produce, protein and frozen goods also arrive in different packaging - cartons, bags, kilograms, bottles. The first version of this workflow preserves the original quantity and the original unit from the PDF and performs no conversion at all. Conversion is a business decision with a lookup table behind it, not a string operation in a workflow.

These two rules are the reason the header has eleven columns rather than a compact five. The extra fields are cheap; a wrong delivery date or a unit-less quantity is not.

4. Fields deliberately left out

A real purchase-order system would want more. We discussed these and left them out of the MVP on purpose:

FieldWhy it is not in this demo
Received DateUseful for audit, but the delivery date is what dispatch depends on
Dispatch Status (Pending / Packed / Dispatched)Requires a write-back loop and a human updating the sheet; adds a second workflow
Source Email / PDF linkNeeds Google Drive archiving and a link written back into the row
Needs Review flagRequires an exception queue and a review process that does not exist yet
ErrorLog sheetOnly meaningful once validation and retry logic exist

This is not oversight; it is scope control. Each of those fields implies a process, and a process implies someone responsible for it. Adding the columns without the process produces a sheet that looks complete but is not maintained, which is worse than an honest small one.

5. Why Google Sheets and not Airtable

Airtable would give us multiple views, status tracking, a product master table and a nicer mobile experience. It is a good tool, and it is the right answer for a second phase when several warehouse staff need to work the same orders at once.

It is not the right answer for this client’s first phase. The client already runs the daily dispatch routine in Google Sheets. Replacing that habit adds training, data migration and a subscription, none of which directly improves tomorrow morning’s dispatch. The value in this project comes from eliminating manual typing, not from changing the tool the warehouse already knows. n8n has native Gmail, PDF and Google Sheets nodes, so the whole MVP fits in the stack the client already uses.

6. Creating the workbook and sharing it with the n8n service account

Here is the gotcha that cost the most time in the actual build, and it has nothing to do with n8n logic.

After creating the sheet and setting up a Google Sheets credential, the node’s Document dropdown could not find Restaurant PO Automation - Demo. The credential was valid; the document simply was not visible to it. Google Sheets nodes can only see files shared with the service account email associated with that credential.

Google Sheets share dialog for the demo workbook

The fix is to open the workbook’s Share dialog and add the service account email from the n8n Google credential as an editor.

Sharing the workbook with the n8n Google service account

Once sharing is in place, return to n8n and refresh the node. The Document and Sheet dropdowns resolve immediately.

Document and Sheet dropdowns resolving after the workbook is shared

If you skip this step, no amount of re-authenticating the OAuth credential will help. Check sharing first.

7. Configuring the Google Sheets node

Add the final node after Code and configure:

ParameterSetting
ResourceSheet Within Document
OperationAppend Row
DocumentRestaurant PO Automation - Demo
SheetOrder_Lines
Mapping Column ModeMap Automatically

Append Row is correct because this workflow accumulates history. Every new purchase order adds its lines; nothing is overwritten. That is what makes the later QUERY reports able to look across all four outlets and both delivery dates.

Map Automatically works here only because the Code node’s output keys were named to match the header exactly. It is a small discipline decision made in Part 3 that removes eleven manual mappings and, more importantly, removes eleven places where a future field rename could silently break the write.

8. Verifying the field mapping

Even with automatic mapping, open the mapping panel and read it once. Confirm that Delivery_Date is going to column C, Outlet_Code to column F, Quantity to column J and Unit to column K. Those four positions matter because the QUERY formulas in Part 5 refer to columns by letter, not by name.

Column mapping between Code node output fields and the eleven-column header

A shifted column here would not throw an error. It would quietly write quantities into the unit column and produce a dispatch report that looks plausible and is wrong. This is the kind of failure that a green execution log cannot catch.

9. First end-to-end append

Execute the node with the five items from PO 01:

CheckResult
Items received by Google Sheets5
Rows appended to Order_Lines5
Nodes green end to end5 of 5
Order_Date / Delivery_Date2026-11-20 / 2026-11-23
Units preservedKG, KG, KG, CTN, BAG

First purchase order written as five rows in the Order_Lines sheet

First-order result card: one PDF, five order records, five of five nodes successful

At this point the loop the client asked for is closed: an email with a PDF arrives, and the order appears in Google Sheets labelled with its outlet, without anyone opening the file. Everything in Part 5 and Part 6 is about making those rows useful and proving they hold up across outlets.

10. The duplicate trap and the demo boundary

There is one operational rule for this MVP: do not manually re-execute the Google Sheets node for an order that already ran. Append Row has no memory. Running it twice appends the same five rows again. In the real test sequence we save and activate the workflow, then send the remaining three emails so Gmail Trigger produces three fresh executions; we never replay the first one by hand.

That is the clearest illustration of the boundary. This is a demo, not a production warehouse system. There is no duplicate detection keyed on PO Number plus outlet plus line, no handling of revised orders, no exception queue, no audit of actual dispatched quantities, and no human review step for a quantity the AI could not read. A production version would keep the original PDF for audit and route uncertain rows to a person before they reach a dispatch sheet. We stop at five nodes because adding those features would not make this case study more convincing; it would add untested claims.

Next: Part 5 - Daily Dispatch and Product Summary with QUERY

Data note: all business data in this series - Harbour Kitchen, its outlets, PO numbers, SKUs, quantities and delivery dates - is fictional mock data for a Self-initiated Demonstration. This is a demo, not a production warehouse system.

Related reading