gspread is a Python API for Google Sheets.
- Google Sheets API v4.
- Open a spreadsheet by its title or url.
- Extract range, entire row or column values.
- Python 3 support.
pip install gspread
Requirements: Python 2.7+ or Python 3+.
- Obtain OAuth2 credentials from Google Developers Console
- Get a cell range from a spreadsheet:
import gspread gc = gspread.authorize(credentials) # Open a worksheet from spreadsheet with one shot wks = gc.open("Where is the money Lebowski?").sheet1 wks.update_acell('B2', "it's down there somewhere, let me take another look.") # Fetch a cell range cell_list = wks.range('A1:B7')
- More 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
- Finding a Cell
- Finding All Matched Cells
- Cell Object
- Updating Cells
How to Contribute¶
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.