Google Sheet API Python

How to use the Google Sheet API using Python.

How to use the Google Sheet API using Python.

There are two ways to do this:

  1. Directly use the Google Sheet API. The downside of this being it takes a significant amount of time to learn and setup all the configuration.
  2. Just use sheet2api. This takes care of all that configuration for you, all you need is the URL to your Google Sheet spreadsheet to get started.

Easy setup

  1. Install the Python package with pip.
  2. pip install sheet2api
  3. Run Google Sheet API request with Python.
  4. from sheet2api import Sheet2APIClient
    
    client = Sheet2APIClient(api_url='https://sheet2api.com/v1/FgI6zV8qT121/characters/')
    client.get_rows()
  5. Create and use your own sheet2api API.

Examples

Here are some ready to use Google Sheet API examples using the Python client. Simply copy them into your project and you're good to go.

Read all rows

# Returns all rows from the first Sheet.
from sheet2api import Sheet2APIClient

client = Sheet2APIClient(api_url='https://sheet2api.com/v1/FgI6zV8qT121/characters/')
client.get_rows()

Read rows which match search terms

# Returns all rows from the first Sheet, filtered by search terms.
from sheet2api import Sheet2APIClient

client = Sheet2APIClient(api_url='https://sheet2api.com/v1/FgI6zV8qT121/characters/')
client.get_rows(query={'name': 'Bugs Bunny'})

Add a new row

# Adds a new row to the Sheet.
from sheet2api import Sheet2APIClient

client = Sheet2APIClient(api_url='https://sheet2api.com/v1/FgI6zV8qT121/characters/')
client.create_row(row={'Name': 'Bugs Bunny', 'Favourite Thing': 'Carrots', 'Image': 'Bugs.png'})

For more in-depth examples check out the Github code repository.


It's as easy as that 🎉.

If you need help, please feel free to send a message via the contact page.

Start using sheet2api now

Be up & running in seconds.