skillfed

gspread-formatting

Complete Google Sheets formatting support for gspread worksheets

gspread-formatting v1.2.1 1.2M downloads/30d#4,250 on PyPI194
Permissive license MIT AGING released

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-formatting

uv

uv add gspread-formatting

poetry

poetry add gspread-formatting

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Office/Business :: Financial :: SpreadsheetTopic :: Software Development :: Libraries :: Python Modules

Tags

google sheets cell formattinggspread formatting librarystyle google spreadsheet cellsconditional formatting google sheetsspreadsheet cell format apifrozen rows columns sheetsdata validation google sheets
google-sheetsspreadsheet-formattingdata-export

More Python Modules packages