Skip to content

v4.0.0

Choose a tag to compare

@Gracecom1 Gracecom1 released this 07 Aug 06:10
· 7 commits to master since this release
b25e29a

First release under new maintenance. The library now works with current gspread, and reading a sheet no longer leaves the awkward parts to the caller.

Breaking

  • Requires gspread 6. Client.auth is now Client.http_client.auth, following gspread's move of HTTP execution into a separate HTTPClient.
  • Requires Python 3.9 and pandas 2.0. gspread 6 needs 3.8 and pandas 2 needs 3.9, so the older versions the package advertised could not have worked.

Added

  • df_to_sheet(..., append=True) adds rows below the data already in a sheet, matching your columns to the headers that are there. A reordered or renamed frame lands in the right place instead of being written positionally. (#86)
  • sheet_to_df(..., convert_types=True) gives columns their real dtypes instead of returning everything as object. Strict: a column converts only when every non-empty value converts cleanly, so one stray N/A leaves the column as text rather than quietly nulling that row. (#18)
  • sheet_to_df(..., detect_layout=True) finds where the table starts, for sheets that open with a report title or a blank row.
  • -1 for unformatted_columns / formula_columns, meaning every column. (#56, thanks @ChristophBoerlin)
  • folder_id on Client.move_file and Spread.move, for destinations a path can't name. (#48, thanks @dtquandt)

All three of the first group work with no configuration and no new dependencies. Setting GSPREAD_PANDAS_AI_API_KEY additionally lets them call an OpenAI-compatible model for the harder cases — renames that don't look alike, stacked headers, types that only make sense from a column's name. The model is only ever asked for a small structured answer, nothing it returns is executed, and anything naming a column, header or type that isn't really there is discarded.

Fixed

  • The rate-limit auto-retry had silently stopped retrying. It matched "RESOURCE_EXHAUSTED" against str(APIError), and gspread 6 no longer puts the status field there. It now reads the structured error.
  • Client.expiry and http_client.login() raised AttributeError. gspread only records credentials when it builds the session itself, and this package always hands one in.
  • No more pandas FutureWarning about silent downcasting when a sheet has a column of blanks. (#102, thanks @IvanKaramazov)

Verified

140 passed on Python 3.9 through 3.13, against both pandas 2.3.3 and 3.0.5.

Published by trusted publishing (OIDC) — no API token involved.