gspread-formatting
Complete Google Sheets formatting support for gspread worksheets
What it is and what it does
gspread-formatting extends the gspread library with a complete API for styling Google Sheets. It wraps the v4 Sheets API's CellFormat specification, exposing all formatting components—background colors, text formatting, alignment, borders, and more—as Python classes that can be composed and applied to cell ranges. The package also handles worksheet-level operations like freezing rows and columns, setting row heights and column widths, managing data validation rules, and supporting right-to-left text direction.
The library is designed to work seamlessly with gspread's worksheet objects. You build format objects by instantiating classes with camelCase keyword arguments, then apply them to ranges using functions like format_cell_range or format_cell_ranges. For users working with Pandas DataFrames, a separate dataframe module provides convenience functions to format worksheets based on DataFrame structure. Format objects are composable, comparable, and support set-like operations (union, difference, intersection).
Use it for:
- Style header rows with background colors, bold text, and centered alignment in a report spreadsheet.
- Apply data validation rules to restrict cell inputs to predefined lists or numeric ranges.
- Format a worksheet populated from a Pandas DataFrame with custom header colors and number formatting.
- Freeze the first row and first column of a large data table for easier navigation.
- Set column widths and row heights to match content and improve readability of exported data.
- Apply conditional formatting rules to highlight cells based on values or conditions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds complete cell formatting support to gspread, enabling you to style Google Sheets cells with colors, fonts, alignment, and conditional formatting, plus control frozen rows/columns and data validation.
Yes. The package is stable, actively maintained, has no security vulnerabilities, and solves a real gap in gspread's capabilities. If you need to programmatically format Google Sheets beyond basic data entry, this is the standard tool. The low install friction and permissive license make adoption straightforward.
Install
gspread-formatting on PyPI
pip
pip install gspread-formattinguv
uv add gspread-formattingpoetry
poetry add gspread-formattingInstalling gspread-formatting
Before you install
Low install friction with a single runtime dependency on gspread. The package is in production/stable status and actively maintained, with a recent release in March 2025 and no known vulnerabilities.
License in practice
MIT license is permissive; you can use this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install gspread-formatting
from gspread_formatting import cellFormat, color, format_cell_range
fmt = cellFormat(
backgroundColor=color(1, 0.9, 0.9),
textFormat={'bold': True},
horizontalAlignment='CENTER'
)
format_cell_range(worksheet, 'A1:J1', fmt)
Requires an authenticated gspread worksheet object; you must have gspread set up with Google Sheets API credentials.
Verify before relying
- Whether the package supports all v4 Sheets API CellFormat features or only a subset of them.
- Performance characteristics when formatting large ranges or many cells in a single operation.
- Compatibility with recent versions of gspread and any breaking changes in the Sheets API.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — gspread |
| Maintenance | aging — 525 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,186,386/month — #4,250 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: gspread_formatting-1.2.1-py2.py3-none-any.whl
Keywords: spreadsheets, google-spreadsheets, formatting, cell-format
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
gspreadgspread provides a Python interface to read,…
permissive · top 1,000 on PyPI
gspread-pandasBridges Google Sheets and pandas DataFrames,…
permissive · top 15,000 on PyPI
gspread-dataframeConverts between Google Sheets worksheets and…
permissive · top 5,000 on PyPI
pygsheetspygsheets provides a Python interface to Google…
permissive · top 5,000 on PyPI
gspread-asyncioProvides an asyncio wrapper around the gspread…
permissive · top 15,000 on PyPI
gsheetsgsheets provides a Python wrapper around the…
permissive · top 15,000 on PyPI
df2gspreadTransfers tabular data between Google…
copyleft · top 15,000 on PyPI
columnarColumnar formats tabular data into aligned,…
permissive · top 5,000 on PyPI
aspose-cells-pythonAspose.Cells for Python via .NET creates,…
unclear · top 15,000 on PyPI