Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Run a Python script on a schedule for free and write the results to Google Sheets (GitHub Actions + gspread)

Описание и применение

Автоматический запуск Python‑скрипта каждый день, который получает погоду из Open‑Meteo и добавляет строку в Google Sheet, используя GitHub Actions, сервис‑аккаунт Google и библиотеку gspread.

Задача

Run a Python script that fetches data every morning and store the result in a Google Sheet without renting a server or keeping a laptop on.

Результат

The workflow runs daily, logs yesterday’s weather to the sheet, and avoids duplicate entries.

Рабочий процесс

  • Create a Google Cloud project and enable the Sheets API.
  • Create a service account, download its JSON key, and keep it secret.
  • Share the target Google Sheet with the service account email as Editor and note the Sheet ID.
  • Create a repository with requirements.txt (gspread>=6,<7 requests>=2.28) and job.py containing the fetch and write logic.
  • Add a GitHub Actions workflow that sets secrets GOOGLE_SA_JSON and SHEET_ID, runs job.py on a cron schedule.
  • The script checks if the date exists in column A; if not, it appends the new row.
  • The workflow logs success or skips if the row already exists.

Доказательства

GitHub Actions runs the script on a cron schedule.

Источник

A service account is a robot Google identity with its own e‑mail address.

Источник

gspread writes the row.

Источник

  • Дата записи: 2026-11-01T14:59:38.406Z