Google Sheets Setup
Dinary-server stores expenses in a Google Sheets spreadsheet. You need a Google service account and a spreadsheet shared with that account.
1. Create a Google Cloud project
- Go to console.cloud.google.com.
- Click Select a project → New Project → name it (e.g.
dinary) → Create. - Select the newly created project.
2. Enable the required APIs
- Go to APIs & Services → Library.
- Search for Google Sheets API → click it → Enable.
- Go back to Library, search for Google Drive API → click it → Enable.
3. Create a service account
- Go to APIs & Services → Credentials → Create Credentials → Service account.
- Fill in:
- Name:
dinary(or any name) - ID: auto-generated
- Name:
- Click Create and Continue → skip optional steps → Done.
4. Download the JSON key
- In Credentials, click the newly created service account.
- Go to Keys → Add Key → Create new key → JSON → Create.
- Save the downloaded file as
~/.config/gspread/service_account.json:
mkdir -p ~/.config/gspread
mv ~/Downloads/your-project-*.json ~/.config/gspread/service_account.json
Warning
Keep this file secret. Never commit it to Git — it is already in .gitignore.
5. Create and share the spreadsheet
- Go to sheets.google.com → create a new spreadsheet.
- Name it (e.g.
Dinary Expenses). - Copy the spreadsheet ID from the URL:
https://docs.google.com/spreadsheets/d/<SPREADSHEET_ID>/edit. - Click Share → paste the service account email (found in the JSON key as
client_email, looks likedinary@project-id.iam.gserviceaccount.com) → set role to Editor → Send.
6. Configure dinary-server
Set these environment variables (in .env or your hosting's env config):
| Variable | Value |
|---|---|
DINARY_GOOGLE_SHEETS_SPREADSHEET_ID |
the spreadsheet ID from step 5 |
DINARY_GOOGLE_SHEETS_CREDENTIALS_PATH |
path to credentials.json (default: credentials.json in the working directory) |
Note
When using docker compose with .env, set GOOGLE_SHEETS_SPREADSHEET_ID (without the DINARY_ prefix) — docker-compose.yml adds the prefix automatically. When running directly (Oracle VM, local dev), set DINARY_GOOGLE_SHEETS_SPREADSHEET_ID.