nithinmurali / pygsheets

Google Sheets Python API v4
https://pygsheets.readthedocs.io/en/latest
Other
1.51k stars 220 forks source link

client.py, line 124, attempt to take index on dict #562

Closed exactstat closed 1 year ago

exactstat commented 1 year ago

Module: client.py
Method: create
Code:

        if folder:
            self.drive.move_file(result['spreadsheetId'],
                                 old_folder=self.drive.spreadsheet_metadata(fid=result['spreadsheetId'])[0].get('parents', [None])[0],
                                 new_folder=folder)

self.drive.spreadsheet_metadata(fid=result['spreadsheetId']) - returns a dict, not a list.

colwynlegitscript commented 1 year ago

I put up a draft PR here with the changes that worked for me: https://github.com/nithinmurali/pygsheets/pull/571. That said, I'm not sure if there are more corner cases that need to be caught.