{"id":13564317,"url":"https://github.com/socialpoint-labs/sheetfu","last_synced_at":"2026-01-04T02:56:20.803Z","repository":{"id":45581533,"uuid":"145391149","full_name":"socialpoint-labs/sheetfu","owner":"socialpoint-labs","description":"Python library to interact with Google Sheets V4 API","archived":false,"fork":false,"pushed_at":"2022-03-16T08:49:17.000Z","size":403,"stargazers_count":852,"open_issues_count":8,"forks_count":40,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-03T09:08:40.435Z","etag":null,"topics":["google-sheets-api","google-sheets-api-v4","google-sheets-orm","google-spreadsheet","python-data","python-library","sheetfu","spreadsheet-manipulation","spreadsheet-mapper","spreadsheet-orm","spreadsheets"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/socialpoint-labs.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2018-08-20T08:48:02.000Z","updated_at":"2025-03-31T14:27:59.000Z","dependencies_parsed_at":"2022-07-20T09:18:41.424Z","dependency_job_id":null,"html_url":"https://github.com/socialpoint-labs/sheetfu","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socialpoint-labs%2Fsheetfu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socialpoint-labs%2Fsheetfu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socialpoint-labs%2Fsheetfu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socialpoint-labs%2Fsheetfu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/socialpoint-labs","download_url":"https://codeload.github.com/socialpoint-labs/sheetfu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247082906,"owners_count":20880740,"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-sheets-api","google-sheets-api-v4","google-sheets-orm","google-spreadsheet","python-data","python-library","sheetfu","spreadsheet-manipulation","spreadsheet-mapper","spreadsheet-orm","spreadsheets"],"created_at":"2024-08-01T13:01:29.600Z","updated_at":"2026-01-04T02:56:20.754Z","avatar_url":"https://github.com/socialpoint-labs.png","language":"Python","funding_links":[],"categories":["Python","Libraries \u0026 Modules"],"sub_categories":["ORM (O/RM and O/R mapping tool)"],"readme":"Sheetfu\n=======\n\n.. image:: https://travis-ci.org/socialpoint-labs/sheetfu.svg?branch=master\n    :target: https://travis-ci.org/socialpoint-labs/sheetfu\n\n\nSheetfu was built to interacts with Google Sheets with a simple, intuitive, and fast API.\nThe primary goal of this library is to adapt the Google App Script API for spreadsheets,\nto Python. With Sheetfu, you can easily get or set cell values, background colors, font\ncolors or any other cell attributes.\n\n\nInstalling\n----------\n\nInstall and update using `pip`_:\n\n.. code-block:: text\n\n    pip install -U Sheetfu\n\n\nA Simple Example\n----------------\n\n.. code-block:: python\n\n    from sheetfu import SpreadsheetApp\n\n    sa = SpreadsheetApp('path/to/secret.json')\n    spreadsheet = sa.open_by_id('\u003cinsert spreadsheet id here\u003e')\n    sheet = spreadsheet.get_sheet_by_name('Sheet1')\n    data_range = sheet.get_data_range()           # returns the sheet range that contains data values.\n\n    # this is how you get things\n    values = data_range.get_values()              # returns a 2D matrix of values.\n    backgrounds = data_range.get_backgrounds()    # returns a 2D matrix of background colors in hex format.\n\n    # this is how you set things\n    data_range.set_background('#000000')          # set every cell backgrounds to black\n    data_range.set_font_color('#ffffff')          # set every cell font colors to white\n\n\nYou can also create your SpreadsheetApp object with environment variables\ninstead of the `secrets.json` file. You can refer to `the authentication tutorial`_ for more info.\n\n.. _the authentication tutorial: https://github.com/socialpoint-labs/sheetfu/blob/master/documentation/authentication.rst\n\nPlease read the `sheetfu API documentation`_ for a more detailed description.\n\n.. _sheetfu API documentation: https://github.com/socialpoint-labs/sheetfu/blob/master/documentation/usage.rst\n\n\nThe Table module\n----------------\n\nSheetfu also contains a table module that abstracts completely the coordinates\nsystem for an ORM-like syntax. The example below is for a sheet with the 3\ncolumns 'name', 'surname' and 'age'.\n\n.. code-block:: python\n\n    from sheetfu import Table\n\n    spreadsheet = SpreadsheetApp('path/to/secret.json').open_by_id('\u003cinsert spreadsheet id here\u003e')\n    data_range = spreadsheet.get_sheet_by_name('people').get_data_range()\n\n    table = Table(data_range, backgrounds=True)\n\n    for item in table:\n        if item.get_field_value('name') == 'foo':\n            item.set_field_value('surname', 'bar')              # this set the surname field value\n        age = item.get_field_value('age')\n        item.set_field_value('age', age + 1)\n        item.set_field_background('age', '#ff0000')             # this set the field 'age' to red color\n\n    # Every set functions are batched for speed performance.\n    # To send the batch update of every set requests you made,\n    # you need to commit the table object as follow.\n    table.commit()\n\n\nYou can refer to the `Table API documentation`_ for a more detailed description.\n\n.. _Table API documentation: https://github.com/socialpoint-labs/sheetfu/blob/master/documentation/table.rst\n\n\nCasting\n-------\n\nAn effort has been made to guide Sheetu as a Google Sheet ORM, where any values\nfound in a spreadsheet are casted to a matching Python object. Since version\n1.5.7, Sheetfu returns `DATE` and `DATE_TIME` as Python `datetime` object.\nSimilarly, setting a cell with a `datetime` object will make the necessary\nparsing and casting to reflect those cells as `DATE_TIME` in the sheet.\n\n.. code-block:: python\n\n    from sheetfu import SpreadsheetApp\n\n    sa = SpreadsheetApp('path/to/secret.json')\n    spreadsheet = sa.open_by_id('\u003cinsert spreadsheet id here\u003e')\n    sheet = spreadsheet.get_sheet_by_name('Sheet1')\n\n    # Assuming the cells are in DATE or DATE_TIME format.\n    cells_with_dates = sheet.get_range_from_a1(\"A1:A2\"))\n\n    print(cells_with_dates.get_values())\n    #   [\n    #       [datetime.datetime(2021, 11, 26, 16, 58, 37, 737940)],\n    #       [datetime.datetime(2021, 11, 26, 16, 58, 37, 737940)]\n    #   ]\n\nThis means we can introduce python datetime operation in our code very\neffectively.\n\n\n.. code-block:: python\n\n    from sheetfu import SpreadsheetApp\n    from datetime import datetime\n\n    sa = SpreadsheetApp('path/to/secret.json')\n    spreadsheet = sa.open_by_id('\u003cinsert spreadsheet id here\u003e')\n    sheet = spreadsheet.get_sheet_by_name('Sheet1')\n\n    a1 = sheet.get_range_from_a1(\"A1\")\n\n    # The following will set today's date in the\n    #cell in the right google sheet format\n    a1.set_value(datetime.today())\n\n\nContributing\n------------\n\nFor guidance on how to make a contribution to Sheetfu, see the `contributing guidelines`_.\n\n.. _contributing guidelines: https://github.com/socialpoint-labs/sheetfu/blob/master/CONTRIBUTING.rst\n\n\nLinks\n-----\n\n* License: `MIT \u003chttps://github.com/socialpoint-labs/sheetfu/blob/master/LICENSE\u003e`_\n* Releases: https://pypi.org/project/sheetfu/\n* Code: https://github.com/socialpoint-labs/sheetfu\n* Issue tracker: https://github.com/socialpoint-labs/sheetfu/issues\n\n\n.. _pip: https://pip.pypa.io/en/stable/quickstart/\n\n\nIf you are looking for the original sheetfu google apps script library, it has been relocated to `this page`_.\n\n.. _this page: https://github.com/socialpoint-labs/sheetfu-apps-script\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocialpoint-labs%2Fsheetfu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsocialpoint-labs%2Fsheetfu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocialpoint-labs%2Fsheetfu/lists"}