Google Sheets Python API

Overview

Google Spreadsheets Python API v4

Simple interface for working with Google Sheets.

Features:

  • Open a spreadsheet by title, key or url.
  • Read, write, and format cell ranges.
  • Sharing and access control.
  • Batching updates.

Installation

pip install gspread

Requirements: Python 2.7+ or Python 3+.

Basic Usage

  1. Create credentials in Google API Console

  2. Start using gspread:

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}})

More Examples

Opening a Spreadsheet

# You can open a spreadsheet by its title as it appears in Google Docs
sh = gc.open('My poor gym results') # <-- Look ma, no keys!

# If you want to be specific, use a key (which can be extracted from
# the spreadsheet's url)
sht1 = gc.open_by_key('0BmgG6nO_6dprdS1MN3d3MkdPa142WFRrdnRRUWl1UFE')

# Or, if you feel really lazy to extract that key, paste the entire url
sht2 = gc.open_by_url('https://docs.google.com/spreadsheet/ccc?key=0Bm...FE&hl')

Creating a Spreadsheet

sh = gc.create('A new spreadsheet')

# But that new spreadsheet will be visible only to your script's account.
# To be able to access newly created spreadsheet you *must* share it
# with your email. Which brings us to…

Sharing a Spreadsheet

sh.share('[email protected]', perm_type='user', role='writer')

Selecting a Worksheet

# Select worksheet by index. Worksheet indexes start from zero
worksheet = sh.get_worksheet(0)

# By title
worksheet = sh.worksheet("January")

# Most common case: Sheet1
worksheet = sh.sheet1

# Get a list of all worksheets
worksheet_list = sh.worksheets()

Creating a Worksheet

worksheet = sh.add_worksheet(title="A worksheet", rows="100", cols="20")

Deleting a Worksheet

sh.del_worksheet(worksheet)

Getting a Cell Value

# With label
val = worksheet.get('B1').first()

# With coords
val = worksheet.cell(1, 2).value

Getting All Values From a Row or a Column

# Get all values from the first row
values_list = worksheet.row_values(1)

# Get all values from the first column
values_list = worksheet.col_values(1)

Getting All Values From a Worksheet as a List of Lists

list_of_lists = worksheet.get_all_values()

Finding a Cell

# Find a cell with exact string value
cell = worksheet.find("Dough")

print("Found something at R%sC%s" % (cell.row, cell.col))

# Find a cell matching a regular expression
amount_re = re.compile(r'(Big|Enormous) dough')
cell = worksheet.find(amount_re)

Finding All Matched Cells

# Find all cells with string value
cell_list = worksheet.findall("Rug store")

# Find all cells with regexp
criteria_re = re.compile(r'(Small|Room-tiering) rug')
cell_list = worksheet.findall(criteria_re)

Updating Cells

# Update a single cell
worksheet.update('B1', 'Bingo!')

# Update a range
worksheet.update('A1:B2', [[1, 2], [3, 4]])

# Update multiple ranges at once
worksheet.batch_update([{
    'range': 'A1:B2',
    'values': [['A1', 'B1'], ['A2', 'B2']],
}, {
    'range': 'J42:K43',
    'values': [[1, 2], [3, 4]],
}])

Documentation

Contributors

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.

Improve Documentation

Documentation is as important as code. If you know how to make it more consistent, readable and clear, please submit a pull request. The documentation files are in docs folder, use reStructuredText markup and rendered by Sphinx.

Contribute code

Please make sure to read the Contributing Guide before making a pull request.

Comments
  • HTTP errors - intermittent

    HTTP errors - intermittent

    I'm getting intermittent HTTP errors when reading or (more frequently) writing to sheets. I moved to Gspread from GoogleCL, and I've been happy with ease and speed, but now I'm getting more of these errors. It works most of the time, but not consistently. Thanks in advance!

    My code for writing is (essentially) here:

    def SaveHistory(History, reassesslist, todaydict, date,did):
        username = '...'
        password = '...'
        sheetname = "Re"
    
        client = gspread.login(username, password)
        spreadsheet = client.open(sheetname)
    
        worksheet = spreadsheet.sheet1
        worksheet.resize(rows=1,cols=12)
    
        for row in reassesslist:
            worksheet.append_row(temp)    
    

    The error (or at least the most recent one that I've gotten): Exception in Tkinter callback Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gspread/client.py", line 137, in open feed = self.get_spreadsheets_feed() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gspread/client.py", line 223, in get_spreadsheets_feed r = self.session.get(url) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gspread/httpsession.py", line 79, in get return self.request('GET', url, **kwargs) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gspread/httpsession.py", line 75, in request raise HTTPError(response) HTTPError

    opened by deltaGPhys 32
  • Intermittent 401 Unauthorized errors

    Intermittent 401 Unauthorized errors

    Sometimes works, sometimes doesn't. Restarting the app helps. Could this be because there is a long lag time between an authorization of a credential with gspread.authorize and then taking actions on the session?

    HTTPError: 401: <HTML>
    <HEAD>
    <TITLE>Unauthorized</TITLE>
    </HEAD>
    <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
    <H1>Unauthorized</H1>
    <H2>Error 401</H2>
    </BODY>
    </HTML>
    Traceback (most recent call last):
      File "/home/mark/timeobserver/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
        return self.wsgi_app(environ, start_response)
      File "/home/mark/timeobserver/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
        response = self.make_response(self.handle_exception(e))
      File "/home/mark/timeobserver/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
        reraise(exc_type, exc_value, tb)
      File "/home/mark/timeobserver/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
        response = self.full_dispatch_request()
      File "/home/mark/timeobserver/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
        rv = self.handle_user_exception(e)
      File "/home/mark/timeobserver/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
        reraise(exc_type, exc_value, tb)
      File "/home/mark/timeobserver/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
        rv = self.dispatch_request()
      File "/home/mark/timeobserver/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
        return self.view_functions[rule.endpoint](**req.view_args)
      File "/home/mark/timeobserver/server.py", line 42, in toggleWork
        worksheet.append_row([session.timeStarted, datetime.datetime.now(), session.durationWorked, session.durationInterrupted, datetime.datetime.now() - session.timeStarted, session.interruptions])
      File "/home/mark/timeobserver/lib/python2.7/site-packages/gspread/models.py", line 525, in append_row
        self.add_rows(1)
      File "/home/mark/timeobserver/lib/python2.7/site-packages/gspread/models.py", line 507, in add_rows
        self.resize(rows=self.row_count + rows)
      File "/home/mark/timeobserver/lib/python2.7/site-packages/gspread/models.py", line 488, in resize
        feed = self.client.get_feed(self_uri)
      File "/home/mark/timeobserver/lib/python2.7/site-packages/gspread/client.py", line 256, in get_feed
        r = self.session.get(url)
      File "/home/mark/timeobserver/lib/python2.7/site-packages/gspread/httpsession.py", line 75, in get
        return self.request('GET', url, **kwargs)
      File "/home/mark/timeobserver/lib/python2.7/site-packages/gspread/httpsession.py", line 71, in request
        response.status_code, response.content))
    

    gspread latest (0.3.0)

    opened by markbao 31
  • gspread.exceptions.SpreadSheetNotFound

    gspread.exceptions.SpreadSheetNotFound

    I read a few of the other issues submitted, nothing seemed to work.

    I think I have correctly imported the gspread and oauth2client modules, I run python 2.7.5, and then when I try gc.open("File") it returns a SpreadSheetNotFound error.

    I have tried gc.open_by_key(), gc.open_by_url(), same error. Yes, the sheet does exist

    Traceback (most recent call last): File "./gspreadtest.py", line 22, in ctacc = gc.open("ct").sheet1 ###Note: tried .Sheet1, .sheet1, and just gc.open("ct) File "/home/ren/Desktop/gspreadtest/gspreadmaster/gspread/client.py", line 150, in open raise SpreadsheetNotFound gspread.exceptions.SpreadsheetNotFound

    Note: this is my first time posting on github, thanks for the great api, if I can get it working :).

    opened by RenSylvain 28
  • Support cell formats (using v4 JSON API)

    Support cell formats (using v4 JSON API)

    Fixes burnash/gspread#531.

    Supports all basic formatting directives for cells, via new format_range() method on Worksheet.

    I've included full test coverage of the added method and property accessors. And a section added to README.

    opened by robin900 27
  • ImportError: cannot import name 'v4'

    ImportError: cannot import name 'v4'

    So, I'm trying to import the gspread library, but after freezing for a few seconds, the console spits out an error in doing so.

    Environment info

    Operating System: Windows 7 Python version: 3.6 gspread version: 2.0.0

    Steps to reproduce

    1. Install gspread and oauth2 (both using Git Bash, acquired at https://git-scm.com/)
    2. Try executing import gspread

    Stack trace or other output that would be helpful

    File "C:\Users\[user]\AppData\Local\Python\Python36-32\lib\site-packages\gspread-2.0.0-py3.6.egg\gspread\__init__.py", line 28, in <module> ImportError: cannot import name 'v4'

    TTL 
    opened by GitMew 27
  • Feature request: Insert row(s) at location

    Feature request: Insert row(s) at location

    Is it possible to create a method that would insert n rows in a specific location? The end of a spreadsheet is not always the desired place for new data. :)

    p.s. Thanks for publishing gspread! It's saved me a ton of time and hassle.

    Feature Request 
    opened by dbyler 26
  • Gspread share function does not send email notifications anymore

    Gspread share function does not send email notifications anymore

    Hi, i am using python 3.7.1 with gspread library version 3.1.0.

    Until the 4th of October 2019, every time i shared a spreadsheet with a user, that user received an email notification. My share function is like this:

    def share_spreadsheet_with_users(self, users_to_share_with):
        """
    
        :param users_to_share_with: the users with whom the spreadsheet will be shared
        :return:
        """
        for user in users_to_share_with:
            **self.spreadsheet.**share(user, perm_type='user', role='writer')
    

    In the code above, the self.spreadsheet is a newly created spreadsheet and has type: gspread.Client

    Ever since 4th October the user is only shared the spreadsheet (which can be seen in the google drive) but the user is NOT also notified on email. What could be the issue ?

    opened by rathegod1992 25
  • breaking API changes on September 13th

    breaking API changes on September 13th

    I received an email from Google today notifying me that my code (that they detected uses the Google Drive API) might require some changes due to a security update they applied.

    The email says (among other things):

    Items that have a Drive API permission with type=domain or type=anyone, where withLink=true (v2) or allowFileDiscovery=false (v3), will be affected by this security update.

    In addition to the item ID, your application may now also need a resource key to access these items. Without a resource key, requests for these items may result in a 404 Not Found error (See below for details). Note that access to items that are directly shared with the user or group are not affected.

    Since gspread abstracts the Google API, my guess is that the changes will need to be made in gspread, and not in my own code. Is this assumption correct?

    If yes, were you guys aware of this change?

    KR

    opened by wosym 24
  • Cannot use default service account in Compute Engine

    Cannot use default service account in Compute Engine

    I'm trying to figure out how I can use the service account associated with a Compute Engine without the need of a JSON file. I cant seem to be able to do that in gspread.

    Google has an example here: https://cloud.google.com/docs/authentication/production

    ` from google.cloud import storage

    # If you don't specify credentials when constructing the client, the
    # client library will look for credentials in the environment.
    storage_client = storage.Client()
    
    # Make an authenticated API request
    buckets = list(storage_client.list_buckets())
    print(buckets)`
    

    For them it just works. No JSON necessary. Can this be replicated in any way in gspread?

    opened by nissankarkifm 23
  • Support clients behind a proxy

    Support clients behind a proxy

    Hi,

    maybe I am missing something super easy but... I can't manage to log in when standing behind a proxy. I tried to set up environment variables without success. Googling a bit it seems httplib is not handling proxy that well. Maybe that's the issue.

    Thanks for this great lib!

    help wanted good first issue 
    opened by jpht 23
  • Unable to authenticate. 403 code

    Unable to authenticate. 403 code

    Trying to login to test this library out and I'm getting an error. I've made sure to install gspread. I created a single python file, test.py. My code is as simple as it gets:

    import gspread
    
    # Login with your Google account
    gc = gspread.login('<username>', '<password>')
    

    Yet when I run this via the terminal python test.py I get the following error:

    Traceback (most recent call last):
      File "test.py", line 4, in <module>
        gc = gspread.login('<username>', '<password>')
      File "/Library/Python/2.7/site-packages/gspread/client.py", line 278, in login
        client.login()
      File "/Library/Python/2.7/site-packages/gspread/client.py", line 99, in login
        raise AuthenticationError("Unable to authenticate. %s code" % ex.code)
    gspread.exceptions.AuthenticationError: Unable to authenticate. 403 code
    

    I confirmed that my login credentials were correct by logging out of Google docs, then logging back in, then copying and pasting the u/p into test.py and still nothing. Any suggestions?

    opened by commadelimited 23
  • Sub sheet name changing automatically sometimes by adding some suffix like `_conflict2130205573`

    Sub sheet name changing automatically sometimes by adding some suffix like `_conflict2130205573`

    my sub sheet name is updating while adding some rows to it. sub sheet name: 'Main_1' but it changed to 'Main_1_conflict2130205573' How can it be possible, is this meaning that cells are merged or cleared for this subsheet?

    opened by raviteja1766 2
  • Print keys if not unique

    Print keys if not unique

    Is your feature request related to a problem? Please describe. My problem is with worksheet.get_all_records(). Gspread 5.7.2.

    I have some large sheets that somehow acquired duplicate headers. This caused an exception because "the given 'expected_headers' are not uniques". Because I had so many headers, it was hard to find and delete the duplicates.

    Describe the solution you'd like I added a check on the sheet keys that prints any duplicates as part of the exception.

    if duplicate_keys := [x for x in keys if keys.count(x) > 1]:
                raise GSpreadException(f"these headers are not uniques: {duplicate_keys}")
    

    image

    Describe alternatives you've considered At first I added a print statement to the existing check:

            # make sure they are uniques
            if len(expected) != len(expected_headers):
                print([x for x in keys if keys.count(x) > 1])
                raise GSpreadException("the given 'expected_headers' are not uniques")
    
    opened by riverscuomo 2
  • AttributeError: 'Spreadsheet' object has no attribute 'transfer_ownership'

    AttributeError: 'Spreadsheet' object has no attribute 'transfer_ownership'

    Code: `import gspread

    sa = gspread.service_account(filename="service_account.json") test = sa.create('Test') test.share('[email protected]', perm_type='user', role='writer', notify=False) for i in test.list_permissions(): if i['emailAddress'] == '[email protected]': print(i['emailAddress']) test.transfer_ownership(i['id'])`

    Traceback:

    AttributeError Traceback (most recent call last) /Users/gbell/Documents/Apps/territory-reporting/test.py in <cell line: 1>() 11 if i['emailAddress'] == '[email protected]': 12 print(i['emailAddress']) ----> 13 test.transfer_ownership(i['id'])

    AttributeError: 'Spreadsheet' object has no attribute 'transfer_ownership'

    opened by bellgriffin 1
  • update supported python versions

    update supported python versions

    overview

    Update the supported versions of python in the released package.

    details

    Currently we support python from 3.6 up to any version. Let's keep this unbounded upward requirements but start from python 3.7 as 3.6 has now been end of life for a year.

    Simplify the package setup conditions too, a simple >=3.7.0 should be enough

    opened by lavigne958 0
  • Bump flake8 from 5.0.4 to 6.0.0

    Bump flake8 from 5.0.4 to 6.0.0

    Bumps flake8 from 5.0.4 to 6.0.0.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies python 
    opened by dependabot[bot] 0
Releases(v5.7.2)
  • v5.7.2(Dec 2, 2022)

  • v5.7.1(Nov 16, 2022)

  • v5.7.0(Nov 13, 2022)

    What's Changed

    • chore: Update outdated LICENSE year by @bluzir in https://github.com/burnash/gspread/pull/1124
    • add dependabot to maintain dependecies by @lavigne958 in https://github.com/burnash/gspread/pull/1126
    • improve trigger on CI by @lavigne958 in https://github.com/burnash/gspread/pull/1134
    • Bump bandit from 1.7.0 to 1.7.4 by @dependabot in https://github.com/burnash/gspread/pull/1133
    • cancel previous run on same ref by @lavigne958 in https://github.com/burnash/gspread/pull/1135
    • Bump actions/setup-python from 2 to 4 by @dependabot in https://github.com/burnash/gspread/pull/1127
    • Bump actions/checkout from 2 to 3 by @dependabot in https://github.com/burnash/gspread/pull/1128
    • Bump black from 22.3.0 to 22.10.0 by @dependabot in https://github.com/burnash/gspread/pull/1132
    • Bump isort from 5.9.3 to 5.10.1 by @dependabot in https://github.com/burnash/gspread/pull/1131
    • Bump codespell from 2.1.0 to 2.2.2 by @dependabot in https://github.com/burnash/gspread/pull/1130
    • add named tuple for DateTimeRenderOption by @lavigne958 in https://github.com/burnash/gspread/pull/1136
    • Feature/copy cut paste by @lavigne958 in https://github.com/burnash/gspread/pull/1138
    • isSheetHidden method added to worksheet.py by @SazidAF in https://github.com/burnash/gspread/pull/1140

    New Contributors

    • @bluzir made their first contribution in https://github.com/burnash/gspread/pull/1124
    • @dependabot made their first contribution in https://github.com/burnash/gspread/pull/1133
    • @SazidAF made their first contribution in https://github.com/burnash/gspread/pull/1140

    Full Changelog: https://github.com/burnash/gspread/compare/v5.6.2...v5.7.0

    Source code(tar.gz)
    Source code(zip)
    gspread-5.7.0-py3-none-any.whl(39.54 KB)
    gspread-5.7.0.tar.gz(50.56 KB)
  • v5.6.2(Oct 23, 2022)

  • v5.6.0(Oct 9, 2022)

    What's Changed

    • Fix clear_note method when using numeric boundaries by @lavigne958 in https://github.com/burnash/gspread/pull/1106
    • Fix a typo in the permissions:create API payload by @jiananma in https://github.com/burnash/gspread/pull/1107
    • Fix spreadsheet URL by @lavigne958 in https://github.com/burnash/gspread/pull/1110
    • Return created permission on Spreadsheet.share() by @lavigne958 in https://github.com/burnash/gspread/pull/1111
    • (fixed #1113) Supply correct Google API v3 permission for domains by @NickCrews in https://github.com/burnash/gspread/pull/1115
    • Bugfix/numericese all by @lavigne958 in https://github.com/burnash/gspread/pull/1119
    • Lavigne958 prepare release 5.6.0 by @lavigne958 in https://github.com/burnash/gspread/pull/1120

    New Contributors

    • @jiananma made their first contribution in https://github.com/burnash/gspread/pull/1107
    • @NickCrews made their first contribution in https://github.com/burnash/gspread/pull/1115

    Full Changelog: https://github.com/burnash/gspread/compare/v5.5.0...v5.6.0

    Source code(tar.gz)
    Source code(zip)
    gspread-5.6.0-py3-none-any.whl(38.06 KB)
    gspread-5.6.0.tar.gz(49.09 KB)
  • v5.5.0(Aug 31, 2022)

    What's Changed

    • Use pathlib by @lavigne958 in https://github.com/burnash/gspread/pull/1057
    • Migrate to drive API V3 by @lavigne958 in https://github.com/burnash/gspread/pull/1060
    • Implement eq method for Cell by @chisvi in https://github.com/burnash/gspread/pull/1063
    • Add missing documentation on set_timeout by @lavigne958 in https://github.com/burnash/gspread/pull/1070
    • Add method to transfer / accept ownership of a spreadsheet by @lavigne958 in https://github.com/burnash/gspread/pull/1068
    • Add client_factory parameter to auth methods by @jlumbroso in https://github.com/burnash/gspread/pull/1075
    • Fix list_protected_ranges by @lavigne958 in https://github.com/burnash/gspread/pull/1076
    • Add function to convert column letter to column index by @lavigne958 in https://github.com/burnash/gspread/pull/1077
    • Fix docstring name of named_range() param by @dgilman in https://github.com/burnash/gspread/pull/1081
    • Fix grammar in docstring for client.export by @dgilman in https://github.com/burnash/gspread/pull/1080
    • Many typo fixes to worksheet docstrings by @dgilman in https://github.com/burnash/gspread/pull/1083
    • Fix function numericise_all by @lavigne958 in https://github.com/burnash/gspread/pull/1082
    • Fix documentation about oauth_from_dict by @lavigne958 in https://github.com/burnash/gspread/pull/1088
    • inherit_from_before option for insert_row/insert_rows by @yongrenjie in https://github.com/burnash/gspread/pull/1092
    • add method to change the color of a tab by @lavigne958 in https://github.com/burnash/gspread/pull/1095
    • docs: Fix a few typos by @timgates42 in https://github.com/burnash/gspread/pull/1094
    • Fix typo in Worksheet.batch_format method by @lavigne958 in https://github.com/burnash/gspread/pull/1101

    New Contributors

    • @chisvi made their first contribution in https://github.com/burnash/gspread/pull/1063
    • @jlumbroso made their first contribution in https://github.com/burnash/gspread/pull/1075
    • @yongrenjie made their first contribution in https://github.com/burnash/gspread/pull/1092

    Full Changelog: https://github.com/burnash/gspread/compare/v5.4.0...v5.5.0

    Source code(tar.gz)
    Source code(zip)
    gspread-5.5.0-py3-none-any.whl(37.99 KB)
    gspread-5.5.0.tar.gz(49.04 KB)
  • v5.4.0(May 31, 2022)

    What's Changed

    • fix typo by @joswlv in https://github.com/burnash/gspread/pull/1031
    • Fix error message in get_all_records by @lavigne958 in https://github.com/burnash/gspread/pull/1028
    • Added feature request #1022. Auto resizing is now available for rows … by @mketer1 in https://github.com/burnash/gspread/pull/1033
    • add new method to hide/show a worksheet by @lavigne958 in https://github.com/burnash/gspread/pull/1030
    • feat: Download PDF from Spreadsheet #1035 by @100paperkite in https://github.com/burnash/gspread/pull/1036
    • Add test on auto_resize_columns by @lavigne958 in https://github.com/burnash/gspread/pull/1039
    • Add method to unmerge cells by @lavigne958 in https://github.com/burnash/gspread/pull/1040
    • Add method to delete a protected range by @lavigne958 in https://github.com/burnash/gspread/pull/1042
    • Feature/clean organize documentation by @lavigne958 in https://github.com/burnash/gspread/pull/1043
    • Add warning about deprecated oauth flow by @lavigne958 in https://github.com/burnash/gspread/pull/1047
    • Add new batch_format method. by @lavigne958 in https://github.com/burnash/gspread/pull/1049
    • Encode string to utf-8 when importing CSV content by @lavigne958 in https://github.com/burnash/gspread/pull/1054

    New Contributors

    • @joswlv made their first contribution in https://github.com/burnash/gspread/pull/1031
    • @mketer1 made their first contribution in https://github.com/burnash/gspread/pull/1033
    • @100paperkite made their first contribution in https://github.com/burnash/gspread/pull/1036

    Full Changelog: https://github.com/burnash/gspread/compare/v5.3.2...v5.4.0

    Source code(tar.gz)
    Source code(zip)
    gspread-5.4.0-py3-none-any.whl(36.32 KB)
    gspread-5.4.0.tar.gz(47.48 KB)
  • v5.3.2(Apr 12, 2022)

  • v5.3.0(Mar 28, 2022)

    What's Changed

    • Feature/rework test cassettes recording by @lavigne958 in https://github.com/burnash/gspread/pull/1004
    • add method list protected ranges by @lavigne958 in https://github.com/burnash/gspread/pull/1008
    • Add new methods to add/list/delete dimensionGroups by @lavigne958 in https://github.com/burnash/gspread/pull/1010
    • Add method to hide rows/columns by @lavigne958 in https://github.com/burnash/gspread/pull/1012
    • Add ability to rename Spreadsheets (via a new Spreadsheet.update_title) by @jansim in https://github.com/burnash/gspread/pull/1013

    New Contributors

    • @jansim made their first contribution in https://github.com/burnash/gspread/pull/1013

    Full Changelog: https://github.com/burnash/gspread/compare/v5.2.0...v5.3.0

    Source code(tar.gz)
    Source code(zip)
    gspread-5.3.0-py3-none-any.whl(33.66 KB)
    gspread-5.3.0.tar.gz(43.70 KB)
  • v5.2.0(Feb 27, 2022)

    What's Changed

    • Copy comments when during spreadsheet copy by @lavigne958 in https://github.com/burnash/gspread/pull/979
    • Update user-guide.rst by @maky-hnou in https://github.com/burnash/gspread/pull/980
    • merge setup test cassettes by @lavigne958 in https://github.com/burnash/gspread/pull/982
    • Feature/add header validation get all records by @lavigne958 in https://github.com/burnash/gspread/pull/984
    • Add timeout to client by @lavigne958 in https://github.com/burnash/gspread/pull/987
    • Feature/update timezone and locale by @lavigne958 in https://github.com/burnash/gspread/pull/989
    • Feature/make case comparison in find by @lavigne958 in https://github.com/burnash/gspread/pull/990
    • Updated API rate limits by @hvinayan in https://github.com/burnash/gspread/pull/993
    • Feature/prevent insert row to sheet with colon by @lavigne958 in https://github.com/burnash/gspread/pull/992

    New Contributors

    • @maky-hnou made their first contribution in https://github.com/burnash/gspread/pull/980
    • @hvinayan made their first contribution in https://github.com/burnash/gspread/pull/993

    Full Changelog: https://github.com/burnash/gspread/compare/v5.1.1...v5.2.0

    Source code(tar.gz)
    Source code(zip)
    gspread-5.2.0-py3-none-any.whl(32.02 KB)
    gspread-5.2.0.tar.gz(42.02 KB)
  • v5.1.1(Dec 22, 2021)

  • v5.1.0(Dec 22, 2021)

  • v5.0.0(Nov 26, 2021)

    5.0.0 (2021-11-26)

    • Fix a typo in HISTORY.rst (#904 by @TurnrDev)

    • Fix typo and fix return value written in docstrings (#903 by @rariyama)

    • Add deprecation warning for delete_row method in documentation (#909 by @javad94)

    • split files models.py and test.py (#912 by @lavigne958)

    • parent 39d1ecb59ca3149a8f46094c720efab883a0dc11 author Christian Clauss [email protected] 1621149013 +0200 commit ter Christian Clauss [email protected] 1630103641 +0200 (#869 by @cclaus)

    • Enable code linter in CI (#915 by @lavigne958)

    • isort your imports (again), so you don't have to (#914 by @cclaus)

    • lint_python.yml: Try 'tox -e py' to test current Python (#916 by @cclaus)

    • Add more flake8 tests (#917 by @cclaus)

    • Update test suite (#918 by @cclaus)

    • Avoid IndexError when row_values() returns an empty row (#920 by @cclaus)

    • Bugfix - remove wrong argument in batch_update docstring (#912 by @lavigne958)

    • Improvement - Add Worksheet.index property (#922 by @lavigne958)

    • Add ability to create directory if it does not exist before saving the credentials to disk. (#925 by @benhoman)

    • Update test framework and VCR and cassettes (#926 by @lavigne958)

    • Delete .travis.yml (#928 by @cclaus)

    • Update tox.ini with all linting commands under lint env (by @lavigne958)

    • Build package and docs in CI (#930 by @lavigne958)

    • Update oauth2.rst (#933 by @amlestin)

    • Update the link to the Google Developers Console (#934 by @Croebh)

    • allow tests to run on windows, add and improve tests in WorksheetTests, add test on unbounded range, use canonical range as specified in the API, add test cassettes, prevent InvalidGridRange, improve code formating (#937 by @Fendse)

    • fix fully qualified class names in API documentation (#944 by @geoffbeier)

    • fix editor_users_emails - get only from list not all users added to spreadsheet (#939 by @Lukasz)

    • add shadow method to get a named range from a speadsheet instance (#941 by @lavigne958)

    • auto_resize_columns (#948 by @FelipeSantos75)

    • add functions for defining, deleting and listing named ranges (#945 by @p-doyle)

    • Implement open sheet within Drive folder (#951 by @datavaluepeople)

    • Fix get range for unbounded ranges (#954 by @lavigne958)

    • remove potential I/O when reading spreadsheet title (956 by @lavigne958)

    • Add include_values_in_response to append_row & append_rows (#957 by @martimarkov)

    • replace raw string "ROWS" & "COLUMNS" to Dimension named tuple, replace raw string "FORMATTED_VALUE", "UNFORMATTED_VALUE", "FORMULA" to ValueRenderOption named tuple, replace raw string "RAW", "USER_ENTERED" to ValueInputOption named tuple (#958 by @ccppoo)

    Source code(tar.gz)
    Source code(zip)
  • v4.0.1(Aug 7, 2021)

  • v4.0.0(Aug 6, 2021)

    • Changed Worksheet.find() method returns None if nothing is found (#899 by @GastonBC)

    • Add Worksheet.batch_clear() to clear multiple ranges. (#897 by @lavigne958)

    • Fix copy_permission argument comparison in Client.copy() method (#898 by @lavigne958)

    • Alow creation of spreadhsheets in a shared drive (#895 by @lavigne958)

    • Allow gspread.oauth() to accept a custom credential file (#891 by @slmtpz)

    • Update tox.ini, remove python2 from env list (#887 by @cclaus)

    • Add SpreadSheet.get_worksheet_by_id() method (#857 by @a-crovetto)

    • Fix store_credentials() when authorized_user_filename is passed (#884 by @neuenmuller)

    • Remove python2 (#879 by @lavigne958)

    • Use Makefile to run tests (#883 by @lavigne958)

    • Update documentation Authentication:For End Users using OAuth Client ID (#835 by @ManuNaEira)

    • Allow fetching named ranges from Worksheet.range() (#809 by @agatti)

    • Update README to only mention python3.3+ (#877 by @lavigne958)

    • Fetch creation and lastUpdate time from SpreadSheet on open (#872 by @lavigne958)

    • Fix bug with Worksheet.insert_row() with value_input_option argument (#873 by @elijabesu)

    • Fix typos in doc and comments (#868 by @cclauss)

    • Auto cast numeric values from sheet cells to python int or float (#866 by @lavigne958)

    • Add Worksheet.get_values() method (#775 by @burnash)

    • Allow gspread.oauth() to accept a custom filename (#847 by @bastienboutonnet)

    • Document dictionary credentials auth (#860 by @dmytrostriletskyi)

    • Add Worksheet.get_note() (#855 by @water-ghosts )

    • Add steps for creating new keys (#856 by @hanzala-sohrab)

    • Add folder_id argument to Client.copy() (#851 by @punnerud)

    • Fix typos in docstrings (#848 by @dgilman)

    Source code(tar.gz)
    Source code(zip)
    gspread-4.0.0-py3-none-any.whl(28.70 KB)
    gspread-4.0.0.tar.gz(39.13 KB)
  • v3.7.0(Feb 18, 2021)

    • Add Worksheet.insert_note(), Worksheet.update_note(), Worksheet.clear_note() (#818 by @lavigne958)

    • Update documentation: oauth2.rst (#836 by @Prometheus3375)

    • Documentation fixes (#838 by @jayeshmanani)

    • Documentation fixes (#845 by @creednaylor)

    • Add Worksheet.insert_cols() (#802 by @AlexeyDmitriev)

    • Documentation fixes (#814 by @hkuffel)

    • Update README.md (#811 by @tasawar-hussain)

    • Add value_render_option parameter to Worksheet.get_all_records() (#776 by @damgad)

    • Remove requests from install_requires (#801)

    • Simplify implementation of Worksheet.insert_rows() (#799 by @AlexeyDmitriev)

    • Add auth.service_account_from_dict() (#785 b7 @mahenzon)

    • Fix ValueRange.from_json() (#791 by @erakli)

    • Update documentation: oauth2.rst (#794 by @elnjensen)

    • Update documentation: oauth2.rst (#789 by @Takur0)

    • Allow auth to be None. Fix #773 (#774 by @lepture)

    Source code(tar.gz)
    Source code(zip)
  • v3.6.0(Apr 30, 2020)

    • Add Worksheet.insert_rows() (#734 by @tr-fi)

    • Add Worksheet.copy_to() (#758 by @JoachimKoenigslieb)

    • Add ability to create a cell instance using A1 notation (#765 by @tivaliy)

    • Add auth.service_account() (#768)

    • Add Authlib usage (#552 by @lepture)

    Source code(tar.gz)
    Source code(zip)
  • v3.5.0(Apr 23, 2020)

    • Simplified OAuth2 flow (#762)

    • Fix Worksheet.delete_rows() index error (#760 by @rafa-guillermo)

    • Deprecate Worksheet.delete_row() (#766)

    • Scope Worksheet.find() to a specific row or a column (#739 by @alfonsocv12)

    • Add Worksheet.add_protected_range() #447 (#720 by @KesterChan01)

    • Add ability to fetch cell address in A1 notation (#763 by @tivaliy)

    • Add Worksheet.delete_columns() (#761 by @rafa-guillermo)

    • Ignore numericising specific columns in get_all_records (#701 by @benjamindhimes)

    • Add option folder_id when creating a spreadsheet (#754 by @Abdellam1994)

    • Add insertDataOption to Worksheet.append_row() and Worksheet.append_rows() (#719 by @lobatt)

    Source code(tar.gz)
    Source code(zip)
  • v3.4.2(Apr 6, 2020)

  • v3.4.1(Apr 5, 2020)

  • v3.4.0(Apr 5, 2020)

    • Remove oauth2client in favor of google-auth #472, #529 (#637 by @BigHeadGeorge)

    • Convert oauth2client credentials to google-auth (#711 by @aiguofer)

    • Remove unnecessary login() from gspread.authorize

    • Fix sheet name quoting issue (#554, #636, #716):

      • Add quotes to worksheet title for get_all_values (#640 by @grlbrwrg, #717 by @zynaxsoft)
      • Escaping title containing single quotes with double quotes (#730 by @vijay-shanker)
      • Use utils.absolute_range_name() to handle range names (#748)
    • Fix numericise(): add underscores test to work in python2 and <python3.6 (#622 by @epicfaace)

    • Add supportsAllDrives to Drive API requests (#709 by @justinr1234)

    • Add Worksheet.merge_cells() (#713 by @lavigne958)

    • Improve Worksheet.merge_cells() and add merge_type parameter (#742 by @aiguofer)

    • Add Worksheet.sort() (#639 by @kirillgashkov)

    • Add ability to reorder worksheets #570 (#571 by @robin900)

      • Add Spreadsheet.reorder_worksheets()
      • Add Worksheet.update_index()
    • Add test_update_cell_objects (#698 by @ogroleg)

    • Add Worksheet.append_rows() (#556 by @martinwarby, #694 by @fabytm)

    • Add Worksheet.delete_rows() (#615 by @deverlex)

    • Add Python 3.8 to Travis CI (#738 by @artemrys)

    • Speed up Client.open() by querying files by title in Google Drive (#684 by @aiguofer)

    • Add freeze, set_basic_filter and clear_basic_filter methods to Worksheet (#574 by @aiguofer)

    • Use Drive API v3 for creating and deleting spreadsheets (#573 by @aiguofer)

    • Implement value_render_option in get_all_values (#648 by @mklaber)

    • Set position of a newly added worksheet (#688 by @djmgit)

    • Add url properties for Spreadsheet and Worksheet (#725 by @CrossNox)

    • Update docs: "APIs & auth" menu deprecation, remove outdated images in oauth2.rst (#706 by @manasouza)

    Source code(tar.gz)
    Source code(zip)
  • v3.3.1(Apr 5, 2020)

  • v3.3.0(Mar 12, 2020)

    • Added Spreadsheet.values_batch_update() (#731)

    • Added:

      • Worksheet.get()
      • Worksheet.batch_get()
      • Worksheet.update()
      • Worksheet.batch_update()
      • Worksheet.format()
    • Added more parameters to Worksheet.append_row() (#726)

    • Fix usage of client.openall when a title is passed in (#572 by @aiguofer)

    Source code(tar.gz)
    Source code(zip)
  • v3.2.0(Jan 30, 2020)

    • Fixed gspread.utils.cell_list_to_rect() on non-rect cell list (#613 by @skaparis)

    • Fixed sharing from Team Drives (#646 by @wooddar)

    • Fixed KeyError in list comprehension in Spreadsheet.remove_permissions() (#643 by @wooddar)

    • Fixed typos in docstrings and a docstring type param (#690 by @pedrovhb)

    • Clarified supported Python versions (#651 by @hugovk)

    • Fixed the Exception message in APIError class (#634 by @lordofinsomnia)

    • Fixed IndexError in Worksheet.get_all_records() (#633 by @AivanF)

    • Added Spreadsheet.values_batch_get() (#705 by @aiguofer)

    Source code(tar.gz)
    Source code(zip)
  • v3.1.0(Nov 27, 2018)

    • Dropped Python 2.6 support

    • Fixed KeyError in urllib.quote in Python 2 (#605, #558)

    • Fixed Worksheet.title being out of sync after using update_title (#542 by @ryanpineo)

    • Fix parameter typos in docs (#616 by @bryanallen22)

    • Miscellaneous docs fixes (#604 by @dgilman)

    • Fixed typo in docs (#591 by @davidefiocco)

    • Added a method to copy spreadsheets (#625 by @dsask)

    • Added with_link attribute when sharing / adding permissions (#621 by @epicfaace)

    • Added ability to duplicate a worksheet (#617)

    • Change default behaviour of numericise function #499 (#502 by @danthelion)

    • Added stacklevel=2 to deprecation warnings

    Source code(tar.gz)
    Source code(zip)
  • v3.0.1(Jun 30, 2018)

  • v3.0.0(Apr 12, 2018)

    • This version drops Google Sheets API v3 support.
      • API v4 was the default backend since version 2.0.0.
      • All v4-related code has been moved from gspread.v4 module to gspread module.
    Source code(tar.gz)
    Source code(zip)
  • v2.1.1(Apr 7, 2018)

  • v2.1.0(Apr 6, 2018)

  • v2.0.1(Apr 1, 2018)

Owner
Anton Burnashev
Co-founder @stampsy, co-authored @neurolearn
Anton Burnashev
A discord bot that utilizes Google's Rest API for Calendar, Drive, and Sheets

Bott This is a discord bot that utilizes Google's Rest API for Calendar, Drive, and Sheets. The bot first takes the sheet from the schedule manager in

null 1 Dec 4, 2021
Autodrive is designed to make it as easy as possible to interact with the Google Drive and Sheets APIs via Python

Autodrive Autodrive is designed to make it as easy as possible to interact with the Google Drive and Sheets APIs via Python. It is especially designed

Chris Larabee 1 Oct 2, 2021
A Discord BOT that uses Google Sheets for storing the roles and permissions of a discord server.

Discord Role Manager Bot Role Manager is a discord BOT that utilizes Google Sheets for the organization of a server's hierarchy and permissions. Detai

Dion Rigatos 17 Oct 13, 2022
Fairstructure - Structure your data in a FAIR way using google sheets or TSVs

Fairstructure - Structure your data in a FAIR way using google sheets or TSVs. These are then converted to LinkML, and from there other formats

Linked data Modeling Language 23 Dec 1, 2022
First Party data integration solution built for marketing teams to enable audience and conversion onboarding into Google Marketing products (Google Ads, Campaign Manager, Google Analytics).

Megalista Sample integration code for onboarding offline/CRM data from BigQuery as custom audiences or offline conversions in Google Ads, Google Analy

Google 76 Dec 29, 2022
Easy Google Translate: Unofficial Google Translate API

easygoogletranslate Unofficial Google Translate API. This library does not need an api key or something else to use, it's free and simple. You can eit

Ahmet Eren Odacı 9 Nov 6, 2022
Google scholar share - Simple python script to pull Google Scholar data from an author's profile

google_scholar_share Simple python script to pull Google Scholar data from an au

Paul Goldsmith-Pinkham 9 Sep 15, 2022
google-resumable-media Apache-2google-resumable-media (🥉28 · ⭐ 27) - Utilities for Google Media Downloads and Resumable.. Apache-2

google-resumable-media Utilities for Google Media Downloads and Resumable Uploads See the docs for examples and usage. Experimental asyncio Support Wh

Google APIs 36 Nov 22, 2022
An attendance bot that joins google meet automatically according to schedule and marks present in the google meet.

Google-meet-self-attendance-bot An attendance bot which joins google meet automatically according to schedule and marks present in the google meet. I

Sarvesh Wadi 12 Sep 20, 2022
Google Drive, OneDrive and Youtube as covert-channels - Control systems remotely by uploading files to Google Drive, OneDrive, Youtube or Telegram

covert-control Control systems remotely by uploading files to Google Drive, OneDrive, Youtube or Telegram using Python to create the files and the lis

Ricardo Ruiz 52 Dec 6, 2022
Automation that uses Github Actions, Google Drive API, YouTube Data API and youtube-dl together to feed BackJam app with new music

Automation that uses Github Actions, Google Drive API, YouTube Data API and youtube-dl together to feed BackJam app with new music

Antônio Oliveira 1 Nov 21, 2021
A Google Charts API for Python, meant to be used as an alternative to matplotlib.

GooPyCharts A Google Charts API for Python 2 and 3, meant to be used as an alternative to matplotlib. Syntax is similar to MATLAB. The goal of this pr

Sagnik Ghosh 202 Oct 4, 2022
🔍 Google Search unofficial API for Python with no external dependencies

Python Google Search API Unofficial Google Search API for Python. It uses web scraping in the background and is compatible with both Python 2 and 3. W

Avi Aryan 204 Dec 28, 2022
Python client library for Google Maps API Web Services

Python Client for Google Maps Services Description Use Python? Want to geocode something? Looking for directions? Maybe matrices of directions? This l

Google Maps 3.8k Jan 1, 2023
(unofficial) Googletrans: Free and Unlimited Google translate API for Python. Translates totally free of charge.

Googletrans Googletrans is a free and unlimited python library that implemented Google Translate API. This uses the Google Translate Ajax API to make

Suhun Han 3.2k Jan 4, 2023
A simple language translator with python and google translate api

Language translator with python A simple language translator with python and google translate api Install pip and python 3.9. All the required depende

null 0 Nov 11, 2021
Monetize your apps with KivAds using Google AdMob api.

KivAds(WIP) Monetize your apps with KivAds using Google AdMob api. KivAds uses the latest version of Google AdMob sdk(version 20.0.0). KivAds exposes

Guhan Sensam 16 Nov 5, 2022
With Google Drive API. My computer and my phone are in love now.

Channel trought Google Drive Google Drive API In this case, "Google Drive App" is the program. To install everything you need(has some extra things),

Luis Quiñones Requelme 1 Dec 15, 2021
Translator based on Google API

Yakusu Toshiko Translator based on Google API. Instance of this bot is running as @yakusubot. Features Add a plus to a language's name to show an orig

Arisu W. 2 Sep 21, 2022