Skip to content

Commit

Permalink
fix uploading header twice if DataFrame is empty, fixes maybelinot#47
Browse files Browse the repository at this point in the history
  • Loading branch information
22764636 committed Nov 8, 2019
1 parent f4cef38 commit 8c4da47
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions df2gspread/df2gspread.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ def upload(df, gfile="/New Spreadsheet", wks_name=None,
>>> wks.title
'Example worksheet'
'''
# check if dataframe is populated else raise error
if len(df) == 0:
raise EmptyDataFrameError('DataFrame is empty, nothing will be uploaded to Google Sheets.')

# access credentials
credentials = get_credentials(credentials)
# auth for gspread
Expand Down

0 comments on commit 8c4da47

Please sign in to comment.