Exports data to a Google Sheets spreadsheet via the gspread library.
Opens a Google Sheets spreadsheet by URL or title, clears the first worksheet, and writes headers plus data rows in a single batch update. Credentials are loaded from a service account JSON file configured in config.yaml under google.service_account_file, or set directly via self.credentials_file.
gspread (listed in requirements.txt)google-auth (listed in requirements.txt)from ObjDataExportGsheets import ObjExportApi
exporter = ObjExportApi()
exporter.credentials_file = "/path/to/creds.json"
exporter.OpenFile("https://docs.google.com/spreadsheets/d/abc123")
exporter.WriteHeader(["Name", "Score"])
exporter.WriteData([["Alice", "95"], ["Bob", "82"]])
exporter.CloseFile()
| Method | Description |
|---|---|
OpenFile(filename) |
Open spreadsheet by URL or title via gspread |
WriteHeader(fields) |
Store column names and track redact columns |
WriteData(data) |
Buffer rows (list of lists) with redaction applied |
CloseFile() |
Clear worksheet and write all rows in one update |
EscapeCSV(val) |
No-op passthrough |
DefaultExtension() |
Returns "gsheet" |