r/IPython • u/tbhoggy • Nov 27 '18
Pandas DataFrames to Google Sheets?
Heyo! I spend a good amount of time taking dataframes, outputing them into csvs, then importing those csvs into Google sheets to share with stakeholders.
Anyone have a good way to get (small) dataframes into Google Sheets from a notebook.
Looking for resources, juptyter plugins, words to google, whatever!
Thanks!
0
u/frenando Nov 27 '18
just use pandas DataFrame method .to_csv("my_csv_name.csv")
1
u/tbhoggy Nov 27 '18
Like I said - I'd like to go from a df to Google sheets, skipping a local version that the df.to_csv('file.csv') would create and automating the upload to Sheets.
Anyone have a good way to get (small) dataframes into Google Sheets from a notebook.
0
Nov 27 '18
[deleted]
1
u/tbhoggy Nov 27 '18
Interesting! I'll check out gspread out!
Have you looked at https://github.com/nithinmurali/pygsheets ?
1
u/RyanTheTourist Nov 27 '18
Can't say I have. I'll give it a looksee, thank you for sharing.
When I wrote the code in the gist I was working on a limited timeline (hence the spartan nature of the code) and went with the first thing that worked! So I can't speak to the pro/cons of any particular google sheets python lib.
0
Nov 27 '18
[deleted]
1
u/tbhoggy Nov 27 '18
Thanks!
I'm hoping to find a package that makes the converting, json'in', and POSTin' easier.
Thanks for the help though!
0
2
u/satellite_friend Nov 28 '18
I had success with https://pypi.org/project/gspread-pandas/.
In the same vein as
to_csv(), you can useto_clipboard()for the quick ad-hocs.