0
votes

I am hoping someone can help me figure out why I can't get the Google Sheets API to return a list of sheets for some users.

I am attempting to use the Google Sheets API to get a list of sheets available from a user's account after they have given authorization.

Things seems to be working for the most part, but I am getting 500 Error for a number of users who have tried to test the functionality. If User1 who experiences the failure shares all of his sheets with User2 who has not experienced the failure, User2 continues to work without experiencing any failure. I believe that rules out an issue with any particular sheet. (Unless of course a sheet that is "shared" with User2 is somehow different than a sheet that is actually in and owned by User1's account.)

I think the problem must be something with this particular user account or their settings, but I don't understand what it might be or how to work around this. The failure is always reproduceable for specific users for whom it fails, and success is always consistent for specific users for whom it does work. It may be important to note that the users with the failures are indeed able to successfully access from the Google Drive and Google Sheets web-interface every sheet in their account (whether owned by them or shared with them).

The requests that have received both failures and successes are being made in exactly the same format. However, the key length is the only real difference I noticed between the requests that succeeded and the requests that failed. In my limited sample set of tests, the successful requests seem to have the longer keys whereas the failed request have shorter keys. Here is an example of each with part of the key redacted:

FAILED https://spreadsheets.google.com/feeds/worksheets/t-4-L-cbXXXXXXXXXXm2lA/private/full

GOOD https://spreadsheets.google.com/feeds/worksheets/1n7rDwb5gwt1XXXXXXXXXXYzUz2_F4nEqMhaK4Odk/private/full

Also, I have tested this with both personal Google user accounts as well as with Google Apps user accounts. I have examples of both types that both work, and that fail.

Does anyone have any ideas how to trouble shoot this, or what else to try, or what other information may be helpful?

Thank you!

2
Would it be possible to make a copy of the failing sheet and then try to access that new copy from the app? i have seen some errors when the sheet hasn't been migrated to new sheets, this one could be related to that. When making the copy, the new file would be a migrated version to new sheets.Gerardo
I am not even trying to access a particular sheet. I am trying to get a list of all sheets for an authorized user. Sharing all of the sheets with a User2 and accessing a list of sheets as a User2 works fine. Which makes me believe that the issue is with User1 setting or something else perhaps, not necessarily sheets themselves.kos
Is the problem listing the spreadsheets, or trying to access the spreadsheets in the list?Eric Koleda
not this is just to list the spreasheetskos

2 Answers

2
votes

The API seems to sometimes return sheets that are no longer available in that user's account. I'm not sure why it does that. However, if you try to enumerate the worksheets within a sheet that is no longer available (or access it in any other way), you will experience a problem since the sheet itself is no longer available. Code your solution so that you don't try to access the contents of any sheets that are no longer available.

0
votes

the FAILED

https://spreadsheets.google.com/feeds/worksheets/t-4-L-cbXXXXXXXXXXm2lA/private/full

seams oddly short are you sure the key is correct?