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.

Issues
  • 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
  • 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.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 25
  • 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
  • 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
  • Unable to login and get spreadsheet.

    Unable to login and get spreadsheet.

    I had to update my simple temperature and humidity code that used gspread and accessed my file on google sheets by simple undername and password. Now, I had to update the code for the new auth system. As end user, I strictly (I think that at least) followed the instructions provided, but I obtain the message "Unable to login and get spreadsheet. ". I am using the phyton code provided by Adafruit. I lost night and nights trying to understand where is my error, with no success. Have someone had the same issue and can help me? thx!

    opened by Micchiu 22
  • After 1 hour of working connection lost

    After 1 hour of working connection lost

    GitHub Issues are for bugs and feature requests.

    File "/usr/local/lib/python3.7/site-packages/telegram/ext/dispatcher.py", line 279, in process_update handler.handle_update(update, self) File "/usr/local/lib/python3.7/site-packages/telegram/ext/callbackqueryhandler.py", line 143, in handle_update return self.callback(dispatcher.bot, update, **optional_args) File "./script_name.py", line 492, in button "spreadsheet_name").worksheet("worksheet").acell( File "/usr/local/lib/python3.7/site-packages/gspread/client.py", line 122, in open self.list_spreadsheet_files() File "/usr/local/lib/python3.7/site-packages/gspread/client.py", line 96, in list_spreadsheet_files res = self.request('get', url, params=params).json() File "/usr/local/lib/python3.7/site-packages/gspread/client.py", line 79, in request raise APIError(response) gspread.exceptions.APIError: { "error": { "errors": [ { "domain": "global", "reason": "authError", "message": "Invalid Credentials", "locationType": "header", "location": "Authorization" } ], "code": 401, "message": "Invalid Credentials" }

    Please do not post usage questions here. For general support from the community, see StackOverflow: http://stackoverflow.com/questions/tagged/gspread

    Issues with usage questions will be closed.

    For bugs please provide the following information.

    Environment info

    Operating System: Ubuntu 16.04 Python version: 3.7 gspread version: 3.1

    Steps to reproduce

    1. After 1 hour of working connection lost

    Stack trace or other output that would be helpful

    opened by paperplane90 21
  • value_input_option='USER_ENTERED' not functioning for worksheet.insert_row()

    value_input_option='USER_ENTERED' not functioning for worksheet.insert_row()

    Important: Please do not post usage questions here. To get a quick response, please ask a question on Stack Overflow using gspread tag. See existing questions: https://stackoverflow.com/questions/tagged/gspread


    Describe the bug value_input_option='USER_ENTERED' parameter does not take effect for worksheet.insert_row() as it does for worksheet.append_row().

    To Reproduce Steps to reproduce the behavior:

    1. define formula inside of fields variable
    2. insert row using field variable and 'USER_ENTERED' parameter
    3. append row using field variable and 'USER_ENTERED' parameter
    4. inserted row shows '=SUM(L2:O2) as cell value
    5. appended row shows =SUM(L2:O2) as cell value (rendered properly as formula)

    Expected behavior Row inserted at index 2 and row appended to end of sheet should both accurately respect the 'USER_ENTERED' parameter and result in no ' at the beginning of cell values.

    Code example*

    fields = [product, "Pending Shipment", msgtimestamp,'', accountemail,'','',"=SUM(L2:O2)",'','','','','','','','', itemprice,'']
    worksheet.insert_row(fields,index=2,value_input_option='USER_ENTERED')
    worksheet.append_row(fields,value_input_option='USER_ENTERED')
    

    Screenshots If applicable, add screenshots to help explain your problem.

    Environment info:

    • Operating System [e.g. Linux, Windows, macOS]: Windows
    • Python version: 3.9
    • gspread version: 3.7

    Stack trace or other output that would be helpful No errors presented. even when parameter is spelled incorrectly. (append row shows errors when spelled incorrectly)

    Additional context Add any other context about the problem here.

    opened by bonzai299 0
  • Documentation for 3.7.0 wrongly lists Worksheet.get_note

    Documentation for 3.7.0 wrongly lists Worksheet.get_note

    Important: Please do not post usage questions here. To get a quick response, please ask a question on Stack Overflow using gspread tag. See existing questions: https://stackoverflow.com/questions/tagged/gspread


    Describe the bug The documentation at https://docs.gspread.org/en/latest/api.html?highlight=get_note#gspread.models.Worksheet.insert_note seems to list get_note as an available method. Unfortunately this is not available until the master branch.

    To Reproduce Steps to reproduce the behavior:

    1. Have the latest 3.x Python
    2. pip install gspread
    3. dir(your_worksheet) (observe existing insert_note but missing get_note methods)

    Expected behavior module should reflect functionality captured in official doc

    Environment info:

    • Operating System [e.g. Linux, Windows, macOS]: Linux
    • Python version: 3.9.0 via pyenv
    • gspread version: gspread==3.7.0
    opened by simonjj 1
  • Update local properties when updating spreadsheet/worksheet

    Update local properties when updating spreadsheet/worksheet

    Is your feature request related to a problem? Please describe. Updating spreadsheet property call does not update local properties.

    ex: call to append_row does not increase property row_count

    Describe the solution you'd like Update local properties when necessary.

    Describe alternatives you've considered One can make the explicit call to sht.fetch_sheet_metadata() to update the properties with latest known values from the API.

    Additional context Warning this only solves the issue for SpreadSheets accessed via a single script. If an other script or a human using a web browser accesses the SpreadSheet and updates it, then the values known localy are still invalid.

    If you are in that case then you must call sht.fetch_sheet_metadata() to prevent concurent accesses etc.

    relates to #545

    Feature Request 
    opened by lavigne958 0
  • Access named ranges from a spreadSheet not from a sheet.

    Access named ranges from a spreadSheet not from a sheet.

    Is your feature request related to a problem? Please describe. NamedRanges are not tight to a particular sheet object, one could create a function that returns a list of Cell objects obtained from only a given namedRange access via an instance of SpreadSheet without having to first get any WorkSheet.

    Describe the solution you'd like Create a new function (likely named namedRange) to get the content of a namedRange

    Describe alternatives you've considered get the first sheet and then get the namedRange, regardless if it is located on the first sheet ot not.

    Additional context From the API v4: only the spreadSheetID and the namedRange name is required to obtain the content https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get

    Feature Request help wanted 
    opened by lavigne958 0
  • Improvement - Split models.py into multiple files.

    Improvement - Split models.py into multiple files.

    The file models.py was getting to big, split it into multiple files.

    closes #871

    Improvement 
    opened by lavigne958 1
  • Can we drop support for Python 2?

    Can we drop support for Python 2?

    Is your feature request related to a problem? Please describe. Can we drop support for legacy Python which died 500+ days ago?

    Also, is the development state still alpha?

    Describe the solution you'd like A clear and concise description of what you want to happen.

    Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

    Additional context Add any other context or screenshots about the feature request here. https://devguide.python.org/#status-of-python-branches https://devguide.python.org/devcycle/#end-of-life-branches

    opened by cclauss 1
  • Split models.py

    Split models.py

    Overview

    The file models.py is getting very big. split it into multiple files, one for each class

    Details

    With time the file models.py grew, it is now too big. It holds multiple classes and make it very inconvenient to access and search for a specific method, attribute, ...

    Split it into multiple files:

    • 1 file per class
    • create a folder named models
    • sort imports and only leave necessary import in each file
    Improvement 
    opened by lavigne958 0
  • Prevent creation of duplicated names

    Prevent creation of duplicated names

    current behavior

    When creating a spreadsheet, Google API does not block when an other Spreadsheet exists with the same name. It will create a second one with the same name.

    Possible improvement

    Add an option on method create that will first check if a spreadsheet with the name exists before creating a new one.

    This could prevent creating a spreadsheet with a name, loosing it's ID then trying to create it again and create a duplicate of the first one.

    errors cases

    If the spreadsheet already exists 2 possibles solutions to warn the user about it:

    • raise an exception (SpreadsheetExists) and do not create a new one. This will maintain a unique path for each action, create only create a new non existing file and open only opens existing files.
    • open and return the spreadsheet with no error. This will change the behavior of gspread but can be handy for a lot of users.

    @aiguofer @burnash What do you think is best?

    Feature Request good first issue help wanted 
    opened by lavigne958 1
  • GitHub Action to lint Python code

    GitHub Action to lint Python code

    Because Travis CI is no longer running on PRs. Output: https://github.com/cclauss/gspread/actions

    Improvement help wanted 
    opened by cclauss 3
  • import_csv: UnicodeEncodeError: 'latin-1' codec can't encode character

    import_csv: UnicodeEncodeError: 'latin-1' codec can't encode character

    Describe the bug The import_csv function fails with unicode input.

    To Reproduce Steps to reproduce the behavior: python3.9 -c 'import gspread; gspread.oauth().import_csv("Test", "β€”")'

    Expected behavior It should import the UTF-8 CSV file without error.

    Code example* As above.

    Screenshots N/A

    Environment info:

    • Operating System: Debian 11 bullseye
    • Python version: 3.9.2
    • gspread version: 3.7.0

    Stack trace or other output that would be helpful

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/sam/.local/lib/python3.9/site-packages/gspread/client.py", line 294, in import_csv
        self.request(
      File "/home/sam/.local/lib/python3.9/site-packages/gspread/client.py", line 64, in request
        response = getattr(self.session, method)(
      File "/usr/lib/python3/dist-packages/requests/sessions.py", line 602, in put
        return self.request('PUT', url, data=data, **kwargs)
      File "/home/sam/.local/lib/python3.9/site-packages/google/auth/transport/requests.py", line 482, in request
        response = super(AuthorizedSession, self).request(
      File "/usr/lib/python3/dist-packages/requests/sessions.py", line 542, in request
        resp = self.send(prep, **send_kwargs)
      File "/usr/lib/python3/dist-packages/requests/sessions.py", line 655, in send
        r = adapter.send(request, **kwargs)
      File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send
        resp = conn.urlopen(
      File "/home/sam/.local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 670, in urlopen
        httplib_response = self._make_request(
      File "/home/sam/.local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 392, in _make_request
        conn.request(method, url, **httplib_request_kw)
      File "/usr/lib/python3.9/http/client.py", line 1255, in request
        self._send_request(method, url, body, headers, encode_chunked)
      File "/usr/lib/python3.9/http/client.py", line 1300, in _send_request
        body = _encode(body, 'body')
      File "/usr/lib/python3.9/http/client.py", line 164, in _encode
        raise UnicodeEncodeError(
    UnicodeEncodeError: 'latin-1' codec can't encode character '\u2014' in position 0: Body ('β€”') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8.
    

    Additional context It works if I write:

    python3.9 -c 'import gspread; gspread.oauth().import_csv("Test", "β€”".encode("utf-8"))'
    

    Well, my test script still fails due to other issues, which I can't be bothered figuring out, but it fixes the encoding problem.

    opened by sam-watkins-sr 0
Releases(v3.7.0)
  • 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)

  • v2.0.0(Mar 11, 2018)

    • Ported the library to Google Sheets API v4. This is a transition release. The v3-related code is untouched, but v4 is used by default. It is encouraged to move to v4 since the API is faster and has more features.

      API v4 is a significant change from v3. Some methods are not backward compatible, so there's no support for this compatibility in gspread either.

      These methods and properties are not supported in v4:

      • Spreadsheet.updated
      • Worksheet.updated
      • Worksheet.export()
      • Cell.input_value
    Source code(tar.gz)
    Source code(zip)
  • v0.6.2(Dec 20, 2016)

  • v0.6.1(Dec 20, 2016)

  • v0.6.0(Dec 14, 2016)

  • v0.5.1(Dec 14, 2016)

    • Fixed a missing return value in utils.a1_to_rowcol #428
    • Fixed url parsing in Client.open_by_url #427
    • Added updated property to Spreadsheet objects #426
    Source code(tar.gz)
    Source code(zip)
  • v0.5.0(Dec 11, 2016)

    • Added method to create blank spreadsheets #253
    • Added method to clear worksheets #156
    • Added method to delete a row in a worksheet #337
    • Changed Worksheet.range method to accept integers as coordinates #142
    • Added default_blank parameter to Worksheet.get_all_records #423
    • Use xml.etree.cElementTree when available to reduce memory usage #348
    • Fixed losing input_value data from following cells in Worksheet.insert_row #338
    • Deprecated Worksheet.get_int_addr and Worksheet.get_addr_int in favour of utils.a1_to_rowcol and utils.rowcol_to_a1 respectively
    Source code(tar.gz)
    Source code(zip)
  • v0.4.1(Jul 16, 2016)

  • 0.4.0(Jun 30, 2016)

  • v0.3.0(Dec 16, 2015)

    • Use Python requests instead of the native HTTPConnection object

    • Optimized row_values and col_values

    • Optimized row_values and col_values Removed the _fetch_cells call for each method. This eliminates the adverse effect on runtime for large worksheets.

      Fixes #285, #190, #179, and #113

    • Optimized row_values and col_values Removed the _fetch_cells call for each method. This eliminates the adverse effect on runtime for large worksheets.

      Fixes #285, #190, #179, and #113

    • Altered insert_row semantics to utilize range This avoids issuing one API request per cell to retrieve the Cell objects after the insertion row. This provides a significant speed-up for insertions at the beginning of large sheets.

    • Added mock tests for Travis (MockSpreadsheetTest)

    • Fixed XML header issue with Python 3

    • Fixed Worksheet.export function and associated test

    • Added spreadsheet feed helper

    • Add CellNotFound to module exports Fixes #88

    • Fixed utf8 encoding error caused by duplicate XML declarations

    • Fixed AttributeError when URLError caught by HTTPError catch block Fixes #257

    • Added __iter__ method to Spreadsheet class

    • Fixed export test

    • Switched tests to oauth

    Source code(tar.gz)
    Source code(zip)
  • v0.2.5(Apr 21, 2015)

  • v0.2.4(Apr 17, 2015)

  • v0.2.3(Mar 11, 2015)

    • Automatically refresh OAuth2 token when it has expired.
    • Added an insert_row method to Worksheet.
    • Moved docs to Read The Docs.
    • Added the numeric_value attribute to Cell.
    • Added title property to Spreadsheet.
    • Support for exporting worksheets.
    • Added row selection for keys in Worksheet.get_all_records.
    Source code(tar.gz)
    Source code(zip)
Owner
Anton Burnashev
Co-founder @stampsy, co-authored @neurolearn
Anton Burnashev
A collective list of free APIs for use in software and web development.

Public APIs A collective list of free APIs for use in software and web development. A public API for this project can be found here! For information o

null 131.1k Jun 13, 2021
Google Sheets Python API v4

pygsheets - Google Spreadsheets Python API v4 A simple, intuitive library for google sheets which gets your work done. Features: Open, create, delete

Nithin Murali 1.2k Jun 13, 2021
Google Sheets Python API

Google Spreadsheets Python API v4 Simple interface for working with Google Sheets. Features: Open a spreadsheet by title, key or url. Read, write, and

Anton Burnashev 5.4k Jun 13, 2021
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 22 Jun 4, 2021
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.2k Jun 13, 2021
Python Telegram bot api.

pyTelegramBotAPI A simple, but extensible Python implementation for the Telegram Bot API. Getting started. Writing your first bot Prerequisites A simp

FrankWang 4.3k Jun 13, 2021
Python wrapper for Wikipedia

Wikipedia API Wikipedia-API is easy to use Python wrapper for Wikipedias' API. It supports extracting texts, sections, links, categories, translations

Martin Majlis 244 Jun 6, 2021
πŸ† A ranked list of awesome machine learning Python libraries. Updated weekly.

Best-of Machine Learning with Python ?? A ranked list of awesome machine learning Python libraries. Updated weekly. This curated list contains 840 awe

Machine Learning Tooling 5.3k Jun 13, 2021
Python interface to the World Bank Indicators and Climate APIs

wbpy A Python interface to the World Bank Indicators and Climate APIs. Readthedocs Github source World Bank API docs The Indicators API lets you acces

Matt Duck 33 Jan 19, 2021
πŸ” 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 191 Jun 8, 2021
A Python library to access Instagram's private API.

Instagram Private API A Python wrapper for the Instagram private API with no 3rd party dependencies. Supports both the app and web APIs. Overview I wr

null 2k Jun 12, 2021
Official Python client for the MonkeyLearn API. Build and consume machine learning models for language processing from your Python apps.

MonkeyLearn API for Python Official Python client for the MonkeyLearn API. Build and run machine learning models for language processing from your Pyt

MonkeyLearn 145 May 19, 2021
Python interface to the LinkedIn API

Python LinkedIn Python interface to the LinkedIn API This library provides a pure Python interface to the LinkedIn Profile, Group, Company, Jobs, Sear

ozgur 770 Jun 9, 2021
Python bindings for BigML.io

BigML Python Bindings BigML makes machine learning easy by taking care of the details required to add data-driven decisions and predictive power to yo

BigML Inc, Machine Learning made easy 266 Jun 14, 2021