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.
pip install gspread
Requirements: Python 3+.
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}})
.. toctree:: :maxdepth: 2 oauth2
.. toctree:: :maxdepth: 2 user-guide
.. toctree:: :maxdepth: 2 advanced
.. toctree:: :maxdepth: 2 api/index
Please make sure to take a moment and read the Code of Conduct.
The best way to get an answer to a question is to ask on Stack Overflow with a gspread tag.
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.
Please make sure to read the Contributing Guide before making a pull request.