1

I've been trying to get a handle on how to use list_ssheets() with a parent_id filter.

The following works well, and returns a list of all the sheets (including the ones I'm trying to isolate from a folder):

the_list_of_sheets = gc.list_ssheets()

list_ssheets() on its own works well and returns all of the sheets, but the follow returns an empty list (the xxxx being the containing folder id):

the_list_of_sheets = gc.list_ssheets('xxxxxxxxxxxxxxxxxxxxxxxxxxx')

I've tried a number of different ways to get this to work, but can't seem to hit the right syntax.

What is the proper way to use list_ssheets() with a parent_id to return all sheets in a particular directory?

Thanks!

Steven Brown
  • 31
  • 1
  • 4
  • Per the [source for the method](https://pygsheets.readthedocs.io/en/latest/_modules/pygsheets/client.html#Client.list_ssheets), that's the way you use it, where you pass the `id` of the folder that contains the spreadsheets you want to access. The result is only an empty list if there were no results, so consider that you have either not authorized with drive scope, or gave the wrong id for the parent folder. – tehhowch Jul 03 '18 at 00:33

1 Answers1

0

Thank you tehhowch, I think I sorted it out.

While the sheets within my target folder were shared with my pgysheets account, the folder itself was not! Silly mistake, but happy to have solved it.

<directory xxxxxxxxxxx>  (must be shared!)
    <file 1>  (shared!)
    <file 2>  (not shared!)
    <file 3>  (shared!)

So now,

the_list_of_sheets = gc.list_ssheets('xxxxxxxxxxx')

Returns a list with file 1 and file 3. Yay!

Steven Brown
  • 31
  • 1
  • 4