Learn how to read from and write to Google Sheets

In this tutorial, we’ll connect an Anvil app to a Google Sheet and read from and write to it, all with nothing but Python.

We’ll build a personal finance tracker that:

  • Displays transactions stored in a Google Sheet
  • Logs new transactions from the app, writing them back to the Sheet
  • Visualises spending by category using an interactive chart

The final app will look something like this:

Completed expense tracker app showing transaction rows, an Add Transaction button, and a 'View Spending Trend' button

If you’re completely new to Anvil, you may want to try our ‘Getting Started’ tutorial before beginning this tutorial.

The techniques you’ll learn in this tutorial are fundamental to building any Anvil app, and mastering them will give you a good understanding of how Anvil works.

Chapters

In this tutorial, you'll:

Build the UI to display your transactions

Build the UI to display data from the connected Google Sheet.

Add new transactions from your Anvil App

Add new transactions to your Google Sheet from your Anvil App.

Visualise your spending

Build an interactive bar chart that breaks down spending by category and time period.

Get More Details

Our docs cover everything about using Google Drive (including Sheets, uploaded images, CSVs and more!) in your Anvil apps. If you prefer to read docs rather than follow a tutorial, take a look!