df2gspread icon indicating copy to clipboard operation
df2gspread copied to clipboard

fix uploading header twice if DataFrame is empty, fixes #47

Open 22764636 opened this issue 5 years ago • 8 comments

returns an error if trying to upload an empty DataFrame to GSheets rather than adding two rows with the DataFrame header

22764636 avatar Nov 08 '19 10:11 22764636

Coverage Status

Coverage decreased (-1.2%) to 28.037% when pulling 8c4da476d22ed4e994a30b4afba02d543c54ed46 on 22764636:empty_dataframe into f4cef3800704aceff2ed08a623a594b558d44898 on maybelinot:master.

coveralls avatar Nov 08 '19 10:11 coveralls

Sorry for not looking closer into the issue, I think better behaviour would be to upload just columns. empty dataframe is a valid input and I don't think raising an error is correct way to handle it.

maybelinot avatar Nov 15 '19 15:11 maybelinot

I agree it would be a better way of handling an empty dataframe however it requires quite a few amendments to your code. If you're comfortable with this I will go ahead and work on the code

22764636 avatar Nov 15 '19 16:11 22764636

Yes, I’m okay with it, ping me if something isn’t clear

maybelinot avatar Nov 15 '19 18:11 maybelinot

I think I have fixed it, there was an issue with row_names = True if DataFrame was empty too, I should have solved both issues

However before pushing the updates want to ask if there was any particular reason you created the clean_worksheet function instead of simply calling wks.clear()? I think it is more efficient compared to calling a different function.

22764636 avatar Nov 18 '19 15:11 22764636

Hi @22764636,

Yes, there was a reason, the idea was to store multiple tables on the same worksheet and being able to clean them up individually, I'd probably want to keep that functionality

maybelinot avatar Dec 02 '19 09:12 maybelinot

just committed a new update, see if it fits your code

22764636 avatar Dec 18 '19 15:12 22764636

Thanks, will look into it over the weekend!

On Wed, 18 Dec 2019 at 16:28, Carmine Migliore [email protected] wrote:

just committed a new update, see if it fits your code

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/maybelinot/df2gspread/pull/48?email_source=notifications&email_token=ABHYTNNLUZRCQS3L5BELWFTQZI6THA5CNFSM4JKVXTT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHGPLYI#issuecomment-567080417, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHYTNMPLKTEFEPGT42O4ULQZI6THANCNFSM4JKVXTTQ .

maybelinot avatar Dec 18 '19 17:12 maybelinot