# Turn last week's cafe sales into this week's grocery order

> See exactly which ingredients next week needs based on what you actually sold, adjust anything by hand, then build a one-click grocery cart.

- Workflow type: app
- Services: Instacart, Square, Google Sheets
- Categories: Operations
- Published: 2026-08-24

## What it does

- Pulls the last seven days of sales from your till and works out how much of each raw ingredient next week will actually need, using your own recipe sheet
- Puts projected usage right next to your on-hand counts and par levels, and flags anything running below par
- Lets you nudge any quantity before you commit, so a catering booking or a quiet week does not throw the whole order off
- Builds a one-click grocery cart from everything flagged and logs the order so you can compare week over week

## What you'll need

- A Square account with your menu items and recent sales
- A Google spreadsheet with a recipe tab listing which ingredients go into each menu item and how much, plus a tab with on-hand counts and par levels
- An Instacart developer account, used to create the one-click cart links
- Menu item names in your recipe sheet that match what they are called on your till

## Prompt

Build me an app for my cafe that turns what we actually sold into this week's grocery run, so I stop walking the shelves with a clipboard and guessing. The people using it are me and whoever does the ordering, and we open it once or twice a week just before placing the order.

The main view is the order planning table. When it loads, pull the last 7 days of completed sales from Square using Search Orders for my chosen location, then resolve every order line item to a menu item using Square Search Catalog Items so I get real menu item names and counts sold. Then read my recipe bill of materials from Google Sheets using Batch Get Values: one tab maps each menu item to its raw ingredients with a quantity and unit per serving, and another tab holds the current on-hand count and par level for each ingredient. Explode the week's sold menu items through the bill of materials to get projected ingredient usage for next week.

Show one row per raw ingredient with projected usage for next week, current on hand, par level, the resulting shortfall, and the quantity to order. Anything below par gets flagged and sorted to the top so it is impossible to miss. Every quantity cell is editable inline, because I know when a catering order is coming and the raw sales number will be wrong. Keep my edits as overrides that survive a refresh of the sales data, and mark clearly which rows I have touched. Also show any sold menu item that has no rows in the bill of materials tab in a small 'not mapped' list, so I can see what the projection is missing instead of silently under-ordering.

Units matter here. Instacart only accepts a limited set of measurement units (each, lb, oz, g, kg, ml, L, cup, tbsp, tsp, gallon) and returns a 4xx on anything else, so normalize the bill of materials units into that set during the explosion, converting where needed. Also round up to quantities I can actually buy: I cannot order 1.3 onions or 0.4 of a milk jug, so round each ingredient to a sensible purchasable amount and show me the rounded number in the table.

A 'Build the order' button takes every flagged ingredient at its current quantity, where my override always wins over the projection, and calls Instacart Create Shopping List Page, grouping the items into sensible store sections like produce, dairy, dry goods and paper goods. Reference each line item by name. Note that product_ids and upcs are mutually exclusive on the same line item, so never send both. Show me the returned one-click cart link prominently. Cache the returned products_link_url with the order record and show the cached link rather than calling Instacart again on every page load; only generate a new link when I build a new order or the existing link has expired.

Right after the cart is created, append the order to a log tab in the same spreadsheet using Google Sheets Append Values: the order date, each ingredient with its ordered quantity and unit, and the cart link. That log is what lets me compare week over week.

Add a second view for order history that reads the log tab and lists past orders newest first, each one expandable to its line items with its cart link, so I can see what I bought and when.

Add an 'Explain the changes' button that kicks off a background agent. The agent pulls several weeks of Square sales history with Search Orders, resolves the items through Search Catalog Items, reads the order log and the bill of materials tabs with Batch Get Values, and compares this week's projection against that history. It writes a short plain-language note back into the app covering which ingredients are trending up or down, what I consistently over-order (ordered heavily while actual usage stayed flat), and which menu items are driving the biggest swings. Show the note in the app with the date it was written, keep previous notes readable underneath, and show live progress while the agent runs rather than a frozen button.

Give me a settings view where I can set the spreadsheet, the tab names for the bill of materials, the on-hand and par tab, the order log tab, the Square location, and the sales lookback window (default 7 days), so none of that is hard-coded.

## How to customize

- Change the sales window the projection is based on, seven days by default, or fourteen if your weeks are uneven
- Adjust the rounding so ingredients land on amounts you actually buy, like whole bags, cases or dozens
- Group the cart into your own store sections, or hold a buffer above par during busy seasons

## FAQ

### Do I need a perfect inventory count for this to work?

No. The app compares projected usage against whatever on-hand numbers you keep in your sheet. Even rough counts updated once a week give you a useful shortfall list, and you can override any quantity before you order.

### What if a menu item is not in my recipe sheet?

It shows up in a short list of items that could not be mapped, so you can see what the projection is missing instead of quietly under-ordering. The rest of the order still builds normally, and once you add the recipe rows it folds in on the next refresh.

### Can I change quantities before ordering?

Yes, every line is editable right in the app. If you know a catering order is coming or a holiday week will be slow, type the number you want and only that number goes into the cart.

### Does this buy the groceries automatically?

No. It builds a ready-to-buy cart link and you check out yourself, so you always get the last look at store, price and substitutions.

### Will it work if I have more than one location?

Yes. You pick which location's sales to read, so you can run it separately for each site against that site's own recipe and inventory sheet.

Use this prompt in General Input: https://www.generalinput.com/prompts/turn-last-weeks-cafe-sales-into-this-weeks-grocery-order