{"id":24441670,"url":"https://github.com/condad/google-objects-python","last_synced_at":"2026-03-03T21:03:15.543Z","repository":{"id":11516619,"uuid":"69916887","full_name":"condad/google-objects-python","owner":"condad","description":"Wraps google-api-python-client for pythonic Google API interaction.","archived":false,"fork":false,"pushed_at":"2022-12-08T12:50:50.000Z","size":174,"stargazers_count":10,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T20:13:23.511Z","etag":null,"topics":["google-drive","google-sheets-api","google-slides-api","python","python-3","sheet"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/condad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-03T22:40:25.000Z","updated_at":"2024-08-23T21:35:10.000Z","dependencies_parsed_at":"2023-01-13T16:32:53.516Z","dependency_job_id":null,"html_url":"https://github.com/condad/google-objects-python","commit_stats":null,"previous_names":["condad/google-objects"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/condad%2Fgoogle-objects-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/condad%2Fgoogle-objects-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/condad%2Fgoogle-objects-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/condad%2Fgoogle-objects-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/condad","download_url":"https://codeload.github.com/condad/google-objects-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625517,"owners_count":21135514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google-drive","google-sheets-api","google-slides-api","python","python-3","sheet"],"created_at":"2025-01-20T21:18:57.446Z","updated_at":"2026-03-03T21:03:10.518Z","avatar_url":"https://github.com/condad.png","language":"Python","readme":"# Google Objects\nThin, pythonic OO wrapper around Google's \"google-api-python-client\" library.\nCurrently supports Python 3+\n\n## Installation\n```bash\n$ pip install google-objects\n```\n\n## Usage\nRequires a valid Google API Credentials object from Google's excellent oauth2lib library. For more information, visit [here](https://developers.google.com/identity/protocols/OAuth2).\n \n### Google Drive v3\n\n- Retrieve drive 'About' information:\n\n```python\nfrom google_objects import DriveClient\n\ngdrive = DriveClient(OAUTH2LIB_CREDS)\nabout = gdrive.get_about()\n\nprint(about.email)\nprint(about.name)\n\n# prints link to profile photo\nprint(about.photo)\n\n# ...\n```\n\n- List files in drive by type:\n\n```python\nfiles_by_type = {\n    'slides': gdrive.list_files('presentation'),\n    'folders': gdrive.list_files('folder'),\n    'spreadsheets': gdrive.list_files('spreadsheets'),\n}\n\nfor file in files_by_type['folders']:\n    print(file.id)\n    print(file.name)\n\nfor file in files_by_type['spreadsheets']:\n    # prints list of parent folder IDs\n    print(file.parents)\n\n# ...\n```\n\n- Copy and share file:\n\n```python\nfile = gdrive.get_file('FILE_ID')\nnew_file = file.copy('NEW_FILE_NAME', ['PARENT_FOLDER_1', 'PARENT_FOLDER_2'])\n\n# allow myfriend@hotmail.com to view\npermission = new_file.add_permission('myfriend@hotmail.com')\n\n# print newly created permission information\nprint(permission.role, permission.type, permission.email)\n```\n\n### Google Slides v1\n\n- Retrieve presentation and loop through elements:\n\n```python\nfrom google_objects import SlidesClient\n\ngslides = SlidesClient(OAUTHLIB_CREDS)\npresentation = gslides.get_presentation('PRESENTATION_ID')\n\n# print slides attributes\nfor slide in presentation:\n    print(slide.id)\n\n    for element in slide: # equivalent to 'for element in presentation.elements()'  \n        print(element.type) \n        # Shape, Table, etc\n```\n\n- Check text in shape:\n\n```python\nshape = presentation.get_element_by_id('SHAPE_ID')\nfor segment in shape.text:\n    print(segment.text)\n```\n\n- Batch update every cell in table:\n\n```python\n# use with to perform batch updates in block\nwith presentation as pres:\n    table = pres.get_element_by_id('TABLE_ID')\n    for cell in table:\n        print(cell.location) # tuple containing cell location\n        for segment in cell.text:\n            # update cell\n            segment.text = 'UPDATED_VALUE'\n```\n\n### Google Sheets v4\n\n- Retrieve spreadsheet and loop through sheets:\n\n```python\nfrom google_objects import SheetsClient\n\ngsheets = SheetsClient(OAUTHLIB_CREDS)\nspreadsheet = gsheets.get_spreadsheet('SPREADSHEET_ID')\n\nfor sheet in spreadsheet:\n    print(sheet.id, sheet.title)\n```\n\n- Get sheet by name and return its full block of values:\n\n```python\nsheet = spreadsheet['Sheet 1']\nvalues = sheet.values() \n```\n\n- Get named range value block:\n\n```python\nnamed_ranges = spreadsheet.named_ranges('SHEET_NAME!A:C')\nfor rng in named_range:\n    values = named_range.get_block()\n```\n\n- Update values block:\n\n```python\nvalues = spreadsheet.get_range('SHEET_NAME!A:C')\n# loop through rows\nfor i, row in enumerate(values):\n    values[i] = [1, 2, 3]\n    print(row)\nvalues.update()\n\n# you can also use the slice syntax for updating..\nvalues[2:5] = [[1,2,4], [4, 5, 6], [6, 7, 8]]\nvalues.update()\n```\n\n- Append to values block:\n\n```python\nto_append = [[1, 2, 3], [4, 5, 6]]\nvalues.append(to_append)  \n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcondad%2Fgoogle-objects-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcondad%2Fgoogle-objects-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcondad%2Fgoogle-objects-python/lists"}