Purpose
This program allows users to download a specified range from a Google Sheet and save it as a CSV file. Additionally, users can upload data from a CSV file to a specified range in a Google Sheet. An optional feature enables clearing existing data in the specified range before writing new data.
Current state
Last touched: 2025-02-18. Functionality and completeness: Download/upload flows are implemented; testing and retries are not documented.
Next step
Add baseline automated tests to cover critical flows; Add CI pipeline for build/test/lint; Document deployment/runtime environment (or add Dockerfile); Document interfaces (CLI flags, API endpoints, file formats); Add structured logging and basic health checks.
Interfaces
Inputs- Service-account JSON key, sheet ID + ranges, CSV input file (for uploads)
- Configuration files (TOML/YAML/JSON/INI/CONF)
- CSV files
Outputs- CSV download file
- Google Sheets range updated with CSV content
- CSV files
Reality to Action trace
Reality IngestionContributes in this stage.
Canonical StorageNot in scope.
Automation EnginesNot in scope.
Human InterfacesContributes in this stage.
Operational AdoptionContributes in this stage.
Core workflow
TBD. Document the 5-10 steps that define the core workflow.
Artifacts
- CSV headers optionally included in upload; range geometry must match expected columns
Operational notes
Constraints and scars
- Depends on Google Sheets API quotas and range limits; large ranges may require chunking in future.
Reliability posture
Failure modes and safe behavior: Auth failures or range errors abort without modifying sheets; partial writes depend on API behavior. Idempotency / retries / batching behavior: Re-running with the same input overwrites target ranges; no explicit retry/backoff documented.
Observability
- Metrics/health checks: None documented
- Logs: stdout/stderr from CLI; no structured metrics beyond exit codes.
Security and privacy
Treat service-account JSON and sheet IDs as sensitive; avoid committing them to git. Sensitive secret material detected in google-sheet-download/priv_key.json; ensure it is excluded from docs and CI.
Ownership
OwnersJosh Barton
UsersJosh Barton (owner)
google-sheet-download
Architecture & Major Components
High-level diagram (text):
- Entry/trigger -> core logic -> outputs (details per docs below)
Entry/trigger
→core logic
→outputs
Entry points: src/main.rs
Top-level folders: src
src/ submodules: config.rs (defaults), Sheets API client helpers
Key abstractions: CLI arg parsing, CSV read/write, Sheets API read/write operations
Setup / Build / Run
- Build system(s): Cargo.
- Install Rust, build the binary with
cargo build --release. - Provide a service-account JSON key and share the target sheet with that account.
- Adjust defaults in
config.rs if you need a custom key path or sheet settings.