Runs: Every evening

Log every receipt email in a spreadsheet

Order confirmations and receipts get copied into a Google Sheet with the shop, date and amount, so your spending adds itself up.

You do not need a budgeting app to see where money goes; you need the numbers in one place. Receipts already arrive by email, so this bot copies them into a sheet you can sort, filter and sum.

  1. Make the sheet

    Create a new Google Sheet called Receipts with the headers Date, From, Subject and Amount in the first row.

  2. Open the script editor from the sheet

    In the sheet, open Extensions → Apps Script. A script attached to this sheet opens in a new tab.

  3. Paste the script

    Replace the editor's contents with this:

    function logReceipts() {
      const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
      const label = GmailApp.getUserLabelByName('logged') || GmailApp.createLabel('logged');
      const threads = GmailApp.search('subject:(receipt OR order OR invoice) -label:logged newer_than:2d');
      for (const thread of threads) {
        const m = thread.getMessages()[0];
        const amount = (m.getPlainBody().match(/[$€£]\s?\d+[.,]\d{2}/) || [''])[0];
        sheet.appendRow([m.getDate(), m.getFrom(), m.getSubject(), amount]);
        thread.addLabel(label);
      }
    }
    
  4. Run it and allow access

    Click Run, allow access, and check that recent receipts appear as rows.

  5. Schedule it for each evening

    Open Triggers, add a trigger for logReceipts, Time-driven, Day timer, 9 pm to 10 pm.

Things that trip people up

  • The by-hand version grabs the first price it sees, which is sometimes a single item instead of the total. Check the first few days.
  • Receipts from shops that send images instead of text won't have an amount.