Create a Tree View of your Google Drive

If you have ever worked with DOS or Linux before, you’ll be familiar with the “tree” command that recursively lists all the files and folders in the current directory in a tree like format. Most of us prefer visual navigation through Windows Explorer or Mac Finder but a unique advantage with the tree command is that you can save and print the directory structure.

Google Drive - Folder Tree

Tree Command for your Google Drive

I have written a little Google Script that is much like running “tree” but against your Google Drive. It creates a hierarchical tree diagram of all the files and folders in your Google Drive that you can save for offline reference or even print.

To get started, click here and authorize the script to access the files in your Google Drive. Once the authorization is complete, it may take a minute to generate the entire Google Drive tree. You’ll then get a link to download an HTML file that mirrors your Drive structure. You can directly send the file to the printer as well.

Internally, all the script does is recursive traversal and the tree itself is sylized through simple CSS. In the current version, only the folder names in the tree are linked to their corresponding location in your Google Drive though the script can be easily extended to create a more data-rich tree that includes details like file URLs, sharing permissions, file sizes, file types and so on.

The process may take slightly longer if you have a large drive with tons of file and folders. Also, as soon as you authorize the Google Drive Tree script, you’ll get an email from Google with instructions on how to revoke access. You can do so as soon as the tree has been generated.

Amit Agarwal

Amit Agarwal

Google Developer Expert, Google Cloud Champion

Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.

Amit has developed several popular Google add-ons including Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory

Awards & Titles

Digital Inspiration has won several awards since it's launch in 2004.

Google Developer Expert

Google Developer Expert

Google awarded us the Google Developer Expert award recogizing our work in Google Workspace.

ProductHunt Golden Kitty

ProductHunt Golden Kitty

Our Gmail tool won the Lifehack of the Year award at ProductHunt Golden Kitty Awards in 2017.

Microsoft MVP Alumni

Microsoft MVP Alumni

Microsoft awarded us the Most Valuable Professional (MVP) title for 5 years in a row.

Google Cloud Champion

Google Cloud Champion

Google awarded us the Champion Innovator title recognizing our technical skill and expertise.

Email Newsletter

Sign up for our email newsletter to stay up to date.

We will never send any spam emails. Promise.