A Python module for writing pandas DataFrame objects directly to Google Spreadsheets
$ pip install dftogsheet
- Enable the Google Sheets API.
- Enter a name for your project. This is the name that will be displayed when your app asks for permission to edit your spreadsheets in Google Drive later.
import pandas as pd import dftogsheet data_frame = pd.DataFrame() dftogsheet.write_to_sheet(data_frame, spreadsheet_id, sheet_name)
There are three mandatory parameters for the above function:
data_frameis any pandas DataFrame object.
spreadsheet_idis the part of the Google Spreadsheet URL that is between
sheet_nameis the name of the sheet within the Google spreadsheet. E.g.
With only the above function, this library pretty much only does one thing.
But there is actually a lot more flexibility provided to you if you know what's going on.
Please look into the two functions in
dftogsheets/__init__.py to understand what is going on
under the hood when you run the above code and to understand how you can use the
and its methods more powerfully. If you have any suggestions, you are always more than welcome
to contribute ;)
Changing scopes, valueInputOption, and location of credentials file
What is the valueInputOption?
Read this page
These settings are actually controlled by the
Config class. A new instance of the
with default values is created for you in
dftogsheet.write_section_to_sheet so you don't have to
think about it for the sample code above. However, it is possible to fully customize
these configurations by creating your own
config object for your project.
Please look into
dftogheets/config.py to understand how you can do that.
What's new in version 0.0.7
- Include this method by default.
How can I contribute?
Thanks for asking!
I appreciate everyone who contributes, no matter how you choose to do it.
And if you feel like conforming to my workflow (which I try to stick to), that's great ;)
- Use Gitflow Workflow.
- Include GitHub issue number in
- If an issue doesn't exist on GitHub, create one.
- Include branch name in every commit message, even on
- Only small "one commit" fixes done directly on
- Commit style: imperitive sentences in all lower case except proper nouns.
- Merge into
developusing pull requests and keeping the entire commmit history.
- Merge into
productionsqushing commits and keeping only version number in commit message.
- At some point I would like to automatically publish every release to pushed to
- If you add new dependencies, don't use
pip freeze > requirements.txt. Add new dependencies manually. Packages we install can install their own dependencies.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size dftogsheet-0.0.7-py3-none-any.whl (7.3 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size dftogsheet-0.0.7.tar.gz (5.6 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for dftogsheet-0.0.7-py3-none-any.whl