Skip to content

GrabFood Expense Tracker for Google Sheets

Tired of manually tracking your GrabFood expenses? This script automates the entire process by connecting to your Gmail, parsing e-receipts, and logging every detail directly into a Google Sheet.

Designed for Google Colab, it leverages native secret management to keep your credentials safe and encrypted.

Ready to get started? Grab the Google Colab Notebook and follow the setup guide below.


  • Monthly Batching: Fetches data in monthly chunks to avoid connection timeouts with Gmail’s IMAP server.
  • Deep Parsing: Uses BeautifulSoup4 to navigate complex HTML email structures, ensuring accurate data extraction.
  • Deduplication: Fingerprints each receipt (Date + Restaurant) to prevent duplicate entries if the script is re-run.
  • Financial Breakdown: Separates the subtotal, delivery fee, order fee, packaging, and promos for easy budgeting.

To connect to Gmail via IMAP, you’ll need an App Password. Standard passwords won’t work if you have 2-Step Verification enabled.

  1. Go to your Google Account Security Settings.
  2. Search for “App Passwords”.
  3. Create a new app named GrabFood Tracker.
  4. Copy the 16-character code. You’ll need it in a later step.
  1. Create a new Google Sheet.
  2. Get your Spreadsheet ID from the URL: docs.google.com/spreadsheets/d/[YOUR_ID_HERE]/edit
  3. The script will automatically create the header row if the sheet is empty.

To keep your credentials secure, use Colab’s secret management:

  1. Open the Google Colab Notebook.
  2. Click the Key icon (Secrets) on the left sidebar.
  3. Add the following secrets:
    • EMAIL_USER: Your full Gmail address.
    • APP_PASSWORD: The 16-character code from Step 1.
  4. Ensure the “Notebook access” toggle is turned ON for both.

The script populates the following columns in your Google Sheet:

Column Description
Date & Exact Time Formatted as M/D/YYYY HH:MM:SS
Restaurant Name The store you ordered from
Restaurant Address Physical address of the restaurant
Items Ordered Quantity and Name (e.g., 2x Nasi Goreng)
Driver Name of the delivery partner
Delivery Address Your delivery destination tag (e.g., “Home”)
Subtotal Price of food before fees
Delivery Shipping/Delivery cost
Order Fee Grab service fee
Packaging Restaurant packaging charge
Promo Total discount applied (expressed as a negative number)
Total Final amount paid

  1. Open the Google Colab Notebook.
  2. Update the SPREADSHEET_ID variable with your ID.
  3. Adjust the start_date and end_date to define your lookup window.
  4. Run the cell. You’ll be prompted to authorize the Google Sheets API.

This script only uses your credentials to establish a local connection between the Google Colab environment and Gmail’s IMAP server. No data is transmitted to third parties. Always keep your APP_PASSWORD secret.


Date & Exact Time Restaurant Name Restaurant Address Items Ordered Driver Delivery Address Subtotal Delivery Order Fee Packaging Promo Total
1/12/2024 18:08:00 Bakpao GaGa Kawangkoan - Apartment Gading Nias Apartement Gading Nias 1x 6 Bakpao Babi Riduan Syahputra Home 75600 17000 3000 - -34900 60700
1/20/2024 8:00:00 Nasi Uduk Hajiten 999 - Rawamangun Jl. H. Ten Raya No. 83 ( Samping Warteg Leman ), 2x Nasi Uduk Telor Dadar, 2x Bakwan Sayuran, 2x Tahu Isi Sopyan Home 44000 12000 3000 - -16400 42600
1/21/2024 10:48:00 Ayam Koplo (Nasi Geprek) - Gading Jl. Gading Putih Raya, No.99 (Sebelah Dr.Soetomo), 1x 5 Nasi Wangi Penyet Sambel Nusantara ABDUL AJID Home 125001 13000 3000 2500 -44250 99251