How to list sub and shared folders by using Google Drive API with a PHP client?

Farid Movsumov
5 min readSep 3, 2023

Allowing users to fetch all folder names from Google Drive, including sub-folders and shared folders, and display them meaningfully to the end user is a complex task requiring you to think about many details in your code. I have been working on a web app in production for over two years, where I faced a lot of edge cases, and I would like to share my experience in this post.

Okay, let’s first see how to display folders to the end user. For simplicity, I decided to show folders in a drop-down…

--

--