df2gspread

raw JSON →
1.0.4 verified Mon Apr 27 auth: no python maintenance

Library to export pandas DataFrames to Google Spreadsheets. Version 1.0.4, last released in 2017. No longer actively maintained.

pip install df2gspread
error AttributeError: module 'df2gspread' has no attribute 'upload'
cause Incorrect import: using 'import df2gspread' then 'df2gspread.upload'
fix
Use 'from df2gspread import df2gspread' then 'df2gspread.upload'
error ImportError: No module named 'oauth2client'
cause oauth2client is no longer installed by default
fix
Install oauth2client: pip install oauth2client, or switch to google-auth
deprecated OAuth2client is deprecated; use google-auth or service account credentials
fix Use gspread's service_account() method and pass gspread client's auth as credentials
gotcha Spreadsheet key must be extracted from the URL, not the full URL
fix Extract key between /d/ and /edit: '1Bxi...'
breaking Library uses deprecated oauth2client; may break with newer gspread versions
fix Pin gspread to <5.0.0 or migrate to df2gspread fork

Upload a pandas DataFrame to an existing Google Sheet using spreadsheet key and worksheet name.

import pandas as pd
from df2gspread import df2gspread

# Create a DataFrame
df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})

# Upload to Google Sheets (requires credentials)
df2gspread.upload(df, '1BxiMVs0XRA5nFMdKv_BdBZTgE3e8eFTe_7fGq6WpJ6E', 'Sheet1', credentials=None)
print('Uploaded successfully')