{ "info": { "author": "Chris Chang", "author_email": "cchang@texastribune.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7" ], "description": "============\ngspreadsheet\n============\n\nA wrapper around a wrapper to get Google spreadsheets to look like\ncsv.DictReader_.\n\nIf you're used to working with CSVs or a human, you'll find that working with\nGoogle's Python API for spreadsheets is so frustrating. With ``gspreadsheet``,\nyou can adapt your existing csv code to work with Google Spreadsheets with just\ntwo line changes. As an added bonus, if you alter the dict, those changes get\nsaved back to the original spreadsheet.\n\n.. _csv.DictReader: http://docs.python.org/2/library/csv.html#csv.DictReader\n\nInstallation\n------------\n\n::\n\n pip install gspreadsheet\n\nUsage\n-----\nIf your old CSV code looked like this::\n\n from csv import DictReader\n reader = DictReader(open('myspreadsheet.csv'))\n for row in reader:\n process(row)\n\nIt would look like this with gspreadsheet::\n\n from gspreadsheet import GSpreadsheet\n reader = GSpreadsheet(\"https://docs.google.com/myspreadsheet\")\n for row in reader:\n process(row)\n\nSo looking at more examples...\n\nGet a spreadsheet if you know the key and worksheet::\n\n sheet = GSpreadsheet(key='tuTazWC8sZ_r0cddKj8qfFg', worksheet=\"od6\")\n\nGet a spreadsheet if you just know the url::\n\n sheet = GSpreadsheet(url=\"https://docs.google.com/spreadsheet/\"\n \"ccc?key=0AqSs84LBQ21-dFZfblMwUlBPOVpFSmpLd3FGVmFtRVE\")\n\nSince just knowing the url is the most common use case, specifying it as a kwarg\nis optional. Just pass whatever url is in your browser as the first argument.::\n\n sheet = GSpreadsheet(\"https://docs.google.com/spreadsheet/\"\n \"ccc?key=0AqSs84LBQ21-dFZfblMwUlBPOVpFSmpLd3FGVmFtRVE\")\n\nGet the JSON representation of the spreadsheet::\n\n sheet.to_JSON()\n\n\nAuthenticating\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nGet a spreadsheet as a certain user::\n\n sheet = GSpreadsheet(email=\"foo@example.com\", password=\"12345\",\n key='tuTazWC8sZ_r0cddKj8qfFg', worksheet=\"od6\")\n\nYou can also specify the email and password using environment variables:\n``GOOGLE_ACCOUNT_EMAIL`` and ``GOOGLE_ACCOUNT_PASSWORD``.\n\nAnd as an authenticated user, you can modify the spreadsheet.::\n\n for row in sheet:\n print row\n if row['deleteme']:\n row.delete() # delete the row from the worksheet\n continue\n row['hash'] = md5(row['name']).hexdigest() # compute the hash and save it back\n\n data = row.copy() # get the last row as a plain dict\n sheet.add_row(data) # copy the last row and append it back to the sheet\n\nAdvanced Usage: Saving data back to the spreadsheet\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nIf you modify the dict that represents a row, those changes will get pushed back\nto the spreadsheet::\n\n >>> row['value']\n 'foo'\n >>> row['value'] = 'bar' # Change this value\n >>> row['value']\n 'bar'\n\nAdvanced Usage: Deferring Saves\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nIf you do multiple changes to a row, the script can get very slow because it has\nto make a syncronous request back to the server with every change. To avoid\nthis, you can turn on deferred saves by setting ``deferred_save=True`` when\ninstantiating a ``GSpreadsheet``. Just remember to ``.save()``::\n\n sheet = GSpreadsheet(email=\"foo@example.com\", password=\"12345\",\n key='tuTazWC8sZ_r0cddKj8qfFg', worksheet=\"od6\",\n deferred_save=True)\n\n row = sheet.next()\n for key in row.keys():\n row['key'] = ''\n row.save()\n\n\nScary Warnings\n--------------\n\nI really want to say this is alpha software, but we've been using bits and\npieces of this for over a year now. Everything is subject to change, even the\nnames. This also relies on google's relatively ancient gdata package, which does\nnot have support for Python 3.\n\n\nChangelog\n---------\n\n* v0.4.0 - Added ``.to_JSON`` method. Added tox coverage.\n\n\n\nSimilar Python packages\n-----------------------\n\n* gspread_\n\n.. _gspread: https://github.com/burnash/gspread", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/texastribune/gspreadsheet", "keywords": null, "license": "Apache Software License", "maintainer": null, "maintainer_email": null, "name": "gspreadsheet", "package_url": "https://pypi.org/project/gspreadsheet/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/gspreadsheet/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/texastribune/gspreadsheet" }, "release_url": "https://pypi.org/project/gspreadsheet/0.4.0/", "requires_dist": null, "requires_python": null, "summary": "A wrapper around a wrapper to get Google spreadsheets to look like DictReader", "version": "0.4.0" }, "last_serial": 981587, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "0a2842ae4c6bef6b84f2428bb456f00a", "sha256": "b1a00a818d158dc47ad3840e228b20bc59a6af3212106fafa3349b85ce933715" }, "downloads": -1, "filename": "gspreadsheet-0.1.2.tar.gz", "has_sig": false, "md5_digest": "0a2842ae4c6bef6b84f2428bb456f00a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6002, "upload_time": "2013-02-22T06:21:31", "url": "https://files.pythonhosted.org/packages/14/bf/00d41037224a376712892cc827a88f828df7c8b867de583b34bef83a2b17/gspreadsheet-0.1.2.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "4c691f61dbb325ac1ae6501363aebe7a", "sha256": "b979d317978f010269ff1803168b9b2f0374bf21fe371c4921b8b7f8f3ac453b" }, "downloads": -1, "filename": "gspreadsheet-0.2.0.tar.gz", "has_sig": false, "md5_digest": "4c691f61dbb325ac1ae6501363aebe7a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6584, "upload_time": "2013-03-04T06:20:31", "url": "https://files.pythonhosted.org/packages/4e/84/32d8a6dfeeab7182f350e5317a0542bf62533d6eca748c7d6c956e698cf1/gspreadsheet-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "176a29eece9f87c0a9d9deceb6042dec", "sha256": "102e4714f5e9f21a1a0118aeaef6772d77013ca03f1028326e9b00fa13143460" }, "downloads": -1, "filename": "gspreadsheet-0.3.0.tar.gz", "has_sig": false, "md5_digest": "176a29eece9f87c0a9d9deceb6042dec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7342, "upload_time": "2013-03-10T06:07:12", "url": "https://files.pythonhosted.org/packages/ac/84/eda182cd439234e8b7e8c90ed828577df7249fefdcf256cdf900b03da5bd/gspreadsheet-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "8d6a7244f115b09d206160ba08c083b6", "sha256": "4b6b4bb2384da8b2fe173f8a906d688ae02c8942204be5c94323cb56cc781fbe" }, "downloads": -1, "filename": "gspreadsheet-0.4.0.tar.gz", "has_sig": false, "md5_digest": "8d6a7244f115b09d206160ba08c083b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7485, "upload_time": "2014-01-26T06:24:04", "url": "https://files.pythonhosted.org/packages/20/67/8ef89fa48e503dc14dbce711efdbd4ae95792d203afb34459934ee3eceb4/gspreadsheet-0.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8d6a7244f115b09d206160ba08c083b6", "sha256": "4b6b4bb2384da8b2fe173f8a906d688ae02c8942204be5c94323cb56cc781fbe" }, "downloads": -1, "filename": "gspreadsheet-0.4.0.tar.gz", "has_sig": false, "md5_digest": "8d6a7244f115b09d206160ba08c083b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7485, "upload_time": "2014-01-26T06:24:04", "url": "https://files.pythonhosted.org/packages/20/67/8ef89fa48e503dc14dbce711efdbd4ae95792d203afb34459934ee3eceb4/gspreadsheet-0.4.0.tar.gz" } ] }