Skip to main content

Google Spreadsheets Python library

Project description

gspread — Google Spreadsheets Python library

gspread is a client library for interacting with Google Spreadsheets.

Features

  • Open a spreadsheet by its title, url or key.

  • Extract range, entire row or column values.

  • Independent of Google Data Python client library.

Example

The following code is a Python program that connects to Google Data API and fetches a cell’s value from a spreadsheet:

import gspread

# Login with your Google account
gc = gspread.login('account@gmail.com','password')

# Spreadsheets can be opened by their title in Google Docs
spreadsheet = gc.open("where's all the money gone 2011")

# Select worksheet by index
worksheet = spreadsheet.get_worksheet(0)

# Get a cell value
val = worksheet.cell(1, 2).value

The cell’s value can be easily updated:

worksheet.update_cell(1, 2, 'Bingo!')

To fetch a cell range, specify it by common notation:

cell_list = worksheet.range('A1:A7')

After some processing, this range can be updated in batch:

for cell in cell_list:
    cell.value = 'O_o'

worksheet.update_cells(cell_list)

Docs & API

Head to gspread’s page.

Code

Check gspread on GitHub.

License

MIT

Download

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gspread-0.0.9.tar.gz (9.4 kB view hashes)

Uploaded Source

Built Distribution

gspread-0.0.9.linux-i686.exe (73.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page