gspread-dataframe


Namegspread-dataframe JSON
Version 4.0.0 PyPI version JSON
download
home_pagehttps://github.com/robin900/gspread-dataframe
SummaryRead/write gspread worksheets using pandas DataFrames
upload_time2024-06-12 21:17:53
maintainerNone
docs_urlhttps://pythonhosted.org/gspread-dataframe/
authorRobin Thomas
requires_pythonNone
licenseMIT
keywords spreadsheets google-spreadsheets pandas dataframe
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            gspread-dataframe
-----------------

.. image:: https://badge.fury.io/py/gspread-dataframe.svg
    :target: https://badge.fury.io/py/gspread-dataframe

.. image:: https://app.travis-ci.com/robin900/gspread-dataframe.svg?branch=master
    :target: https://travis-ci.com/robin900/gspread-dataframe

.. image:: https://img.shields.io/pypi/dm/gspread-dataframe.svg
    :target: https://pypi.org/project/gspread-dataframe

.. image:: https://readthedocs.org/projects/gspread-dataframe/badge/?version=latest
    :target: https://gspread-dataframe.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

This package allows easy data flow between a worksheet in a Google spreadsheet
and a Pandas DataFrame. Any worksheet you can obtain using the ``gspread`` package
can be retrieved as a DataFrame with ``get_as_dataframe``; DataFrame objects can
be written to a worksheet using ``set_with_dataframe``:

.. code:: python

    import pandas as pd
    from gspread_dataframe import get_as_dataframe, set_with_dataframe

    worksheet = some_worksheet_obtained_from_gspread_client

    df = pd.DataFrame.from_records([{'a': i, 'b': i * 2} for i in range(100)])
    set_with_dataframe(worksheet, df)

    df2 = get_as_dataframe(worksheet)

The ``get_as_dataframe`` function supports the keyword arguments
that are supported by your Pandas version's text parsing readers,
such as ``pandas.read_csv``. Consult `your Pandas documentation for a full list of options <https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html>`__. Since the ``'python'`` engine in Pandas is used for parsing,
only options supported by that engine are acceptable:

.. code:: python

    import pandas as pd
    from gspread_dataframe import get_as_dataframe

    worksheet = some_worksheet_obtained_from_gspread_client

    df = get_as_dataframe(worksheet, parse_dates=True, usecols=[0,2], skiprows=1, header=None)

New in version 4.0.0: `drop_empty_rows` and `drop_empty_columns` parameters, both `True`
by default, are now accepted by `get_as_dataframe`. If you created a Google sheet with the default
number of columns and rows (20 columns, 1000 rows), but have meaningful values for the DataFrame
only in the top left corner of the worksheet, these parameters will cause any empty rows
or columns to be discarded automatically.

Formatting Google worksheets for DataFrames
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you install the ``gspread-formatting`` package, you can additionally format a Google worksheet to suit the  
DataFrame data you've just written. See the `package documentation for details <https://github.com/robin900/gspread-formatting#formatting-a-worksheet-using-a-pandas-dataframe>`__, but here's a short example using the default formatter:

.. code:: python

    import pandas as pd
    from gspread_dataframe import get_as_dataframe, set_with_dataframe
    from gspread_formatting.dataframe import format_with_dataframe

    worksheet = some_worksheet_obtained_from_gspread_client

    df = pd.DataFrame.from_records([{'a': i, 'b': i * 2} for i in range(100)])
    set_with_dataframe(worksheet, df)
    format_with_dataframe(worksheet, df, include_column_header=True)

    
Installation
------------

Requirements
~~~~~~~~~~~~

* Python 2.7, 3+
* gspread (>=3.0.0; to use older versions of gspread, use gspread-dataframe releases of 2.1.1 or earlier)
* Pandas >= 0.24.0

From PyPI
~~~~~~~~~

.. code:: sh

    pip install gspread-dataframe

From GitHub
~~~~~~~~~~~

.. code:: sh

    git clone https://github.com/robin900/gspread-dataframe.git
    cd gspread-dataframe
    python setup.py install

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/robin900/gspread-dataframe",
    "name": "gspread-dataframe",
    "maintainer": null,
    "docs_url": "https://pythonhosted.org/gspread-dataframe/",
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "spreadsheets, google-spreadsheets, pandas, dataframe",
    "author": "Robin Thomas",
    "author_email": "rthomas900@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b4/bc/82a1a8a850468b5db7f894f2f73f690a927a5bf59a67581317c00c0a86d8/gspread-dataframe-4.0.0.tar.gz",
    "platform": null,
    "description": "gspread-dataframe\n-----------------\n\n.. image:: https://badge.fury.io/py/gspread-dataframe.svg\n    :target: https://badge.fury.io/py/gspread-dataframe\n\n.. image:: https://app.travis-ci.com/robin900/gspread-dataframe.svg?branch=master\n    :target: https://travis-ci.com/robin900/gspread-dataframe\n\n.. image:: https://img.shields.io/pypi/dm/gspread-dataframe.svg\n    :target: https://pypi.org/project/gspread-dataframe\n\n.. image:: https://readthedocs.org/projects/gspread-dataframe/badge/?version=latest\n    :target: https://gspread-dataframe.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\nThis package allows easy data flow between a worksheet in a Google spreadsheet\nand a Pandas DataFrame. Any worksheet you can obtain using the ``gspread`` package\ncan be retrieved as a DataFrame with ``get_as_dataframe``; DataFrame objects can\nbe written to a worksheet using ``set_with_dataframe``:\n\n.. code:: python\n\n    import pandas as pd\n    from gspread_dataframe import get_as_dataframe, set_with_dataframe\n\n    worksheet = some_worksheet_obtained_from_gspread_client\n\n    df = pd.DataFrame.from_records([{'a': i, 'b': i * 2} for i in range(100)])\n    set_with_dataframe(worksheet, df)\n\n    df2 = get_as_dataframe(worksheet)\n\nThe ``get_as_dataframe`` function supports the keyword arguments\nthat are supported by your Pandas version's text parsing readers,\nsuch as ``pandas.read_csv``. Consult `your Pandas documentation for a full list of options <https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html>`__. Since the ``'python'`` engine in Pandas is used for parsing,\nonly options supported by that engine are acceptable:\n\n.. code:: python\n\n    import pandas as pd\n    from gspread_dataframe import get_as_dataframe\n\n    worksheet = some_worksheet_obtained_from_gspread_client\n\n    df = get_as_dataframe(worksheet, parse_dates=True, usecols=[0,2], skiprows=1, header=None)\n\nNew in version 4.0.0: `drop_empty_rows` and `drop_empty_columns` parameters, both `True`\nby default, are now accepted by `get_as_dataframe`. If you created a Google sheet with the default\nnumber of columns and rows (20 columns, 1000 rows), but have meaningful values for the DataFrame\nonly in the top left corner of the worksheet, these parameters will cause any empty rows\nor columns to be discarded automatically.\n\nFormatting Google worksheets for DataFrames\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nIf you install the ``gspread-formatting`` package, you can additionally format a Google worksheet to suit the  \nDataFrame data you've just written. See the `package documentation for details <https://github.com/robin900/gspread-formatting#formatting-a-worksheet-using-a-pandas-dataframe>`__, but here's a short example using the default formatter:\n\n.. code:: python\n\n    import pandas as pd\n    from gspread_dataframe import get_as_dataframe, set_with_dataframe\n    from gspread_formatting.dataframe import format_with_dataframe\n\n    worksheet = some_worksheet_obtained_from_gspread_client\n\n    df = pd.DataFrame.from_records([{'a': i, 'b': i * 2} for i in range(100)])\n    set_with_dataframe(worksheet, df)\n    format_with_dataframe(worksheet, df, include_column_header=True)\n\n    \nInstallation\n------------\n\nRequirements\n~~~~~~~~~~~~\n\n* Python 2.7, 3+\n* gspread (>=3.0.0; to use older versions of gspread, use gspread-dataframe releases of 2.1.1 or earlier)\n* Pandas >= 0.24.0\n\nFrom PyPI\n~~~~~~~~~\n\n.. code:: sh\n\n    pip install gspread-dataframe\n\nFrom GitHub\n~~~~~~~~~~~\n\n.. code:: sh\n\n    git clone https://github.com/robin900/gspread-dataframe.git\n    cd gspread-dataframe\n    python setup.py install\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Read/write gspread worksheets using pandas DataFrames",
    "version": "4.0.0",
    "project_urls": {
        "Homepage": "https://github.com/robin900/gspread-dataframe"
    },
    "split_keywords": [
        "spreadsheets",
        " google-spreadsheets",
        " pandas",
        " dataframe"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c92fffb71b19208cf3d3e1e1323716de07bdb46e24c850f2c5627cb8157d9687",
                "md5": "e18d158e94a925c28afee77368a506a3",
                "sha256": "19a3c6cd95bf85f8d6c3657227bb921ef36110174d365cc576defe4ed45b6f7d"
            },
            "downloads": -1,
            "filename": "gspread_dataframe-4.0.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e18d158e94a925c28afee77368a506a3",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 9046,
            "upload_time": "2024-06-12T21:17:51",
            "upload_time_iso_8601": "2024-06-12T21:17:51.766697Z",
            "url": "https://files.pythonhosted.org/packages/c9/2f/ffb71b19208cf3d3e1e1323716de07bdb46e24c850f2c5627cb8157d9687/gspread_dataframe-4.0.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b4bc82a1a8a850468b5db7f894f2f73f690a927a5bf59a67581317c00c0a86d8",
                "md5": "1ad6c5da578a9cc32ca3101689eae421",
                "sha256": "5ca5493478ecae49b833664a06bac8e17b5b4ed0bdf77f551c948f30545860e6"
            },
            "downloads": -1,
            "filename": "gspread-dataframe-4.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1ad6c5da578a9cc32ca3101689eae421",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 27400,
            "upload_time": "2024-06-12T21:17:53",
            "upload_time_iso_8601": "2024-06-12T21:17:53.184644Z",
            "url": "https://files.pythonhosted.org/packages/b4/bc/82a1a8a850468b5db7f894f2f73f690a927a5bf59a67581317c00c0a86d8/gspread-dataframe-4.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-12 21:17:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "robin900",
    "github_project": "gspread-dataframe",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "lcname": "gspread-dataframe"
}
        
Elapsed time: 0.38739s