gspread¶
gspread is a Python API for Google Sheets.
Features:
- Google Sheets API v4.
- Open a spreadsheet by title, key or url.
- Read, write, and format cell ranges.
- Sharing and access control.
- Batching updates.
Quick Example¶
import gspread
gc = gspread.service_account()
# Open a sheet from a spreadsheet in one go
wks = gc.open("Where is the money Lebowski?").sheet1
# Update a range of cells using the top left corner address
wks.update('A1', [[1, 2], [3, 4]])
# Or update a single cell
wks.update('B42', "it's down there somewhere, let me take another look.")
# Format the header
wks.format('A1:B1', {'textFormat': {'bold': True}})
Getting Started¶
Usage¶
- Examples of gspread Usage
- Opening a Spreadsheet
- Creating a Spreadsheet
- Sharing a Spreadsheet
- Selecting a Worksheet
- Creating a Worksheet
- Deleting a Worksheet
- Getting a Cell Value
- Getting All Values From a Row or a Column
- Getting All Values From a Worksheet as a List of Lists
- Getting All Values From a Worksheet as a List of Dictionaries
- Finding a Cell
- Finding All Matched Cells
- Clear A Worksheet
- Cell Object
- Updating Cells
- Formatting
- Using gspread with pandas
- Using gspread with NumPy
Advanced¶
API Documentation¶
How to Contribute¶
Please make sure to take a moment and read the Code of Conduct.
Ask Questions¶
The best way to get an answer to a question is to ask on Stack Overflow with a gspread tag.
Report Issues¶
Please report bugs and suggest features via the GitHub Issues.
Before opening an issue, search the tracker for possible duplicates. If you find a duplicate, please add a comment saying that you encountered the problem as well.
Contribute code¶
Please make sure to read the Contributing Guide before making a pull request.