How to List Files in a Folder and Subfolder on Google Drive

Do you want to list files in a folder and a subfolder from Drive? Then follow this tutorial to get the things easier.

Google Drive has lots of predefined tools that are used to modify, create, and edit files. There is no application or specific tool to display the contents of a folder or subfolder.

Generally, when you are viewing Google Drive, you can see the list of files available on it. However the same cannot applied to different folders and subfolders.

This method will include Google Script but it is not difficult. Hence, in this article, we will learn how to use Google Apps Script to create a list of all the files and folders on your Drive and their links.

How to List Files in a Folder and Subfolder on Google Drive?

There are a couple of scripts that you can find online and paste into Google Apps Script editor to get a list of files inside a folder.

However, we have created a detailed explanation using the method which was found to work the best.

  • Go to the Google Drive application from your preferred browser.
  • Enter your details to access the Drive. 
  • Once you are logged in, please move to the side menu and click on the New button on top of it. 
Files and folders from Drive
  • Select Google Sheets and click on Blank spreadsheet from the menu. 
List Files and folders from Google Drive
  • When the blank spreadsheet opens up, head over to the toolbar click on Extensions, and select Apps script from the menu. 
List files and folders from the Google Drive
  • A new tab will open up with the Google Apps Script editor and delete everything from the main body of the script. 
  • Move to this website, copy the code they have written, and paste it into the script editor. 
  • After pasting it, click on the Save icon on the toolbar. 
List folders from Drive
  • Once the script is saved, click on the Run button next to the Save icon on the toolbar. 
  • This will check the code and then tell you to review the permissions as this script accesses your files in Drive. Click on Review permissions.
List files and folders from Google Drive app
  • Choose the account you want, click on Advanced, and select the Go to button at the bottom with “unsafe” written next. 
  • Next, go back to the same Google Sheets page you used to open this script editor and refresh it. 
  • Once refreshed, you will see an option labeled “List File/Folders” in the toolbar. Click on it and choose List All Files and Folders from the menu. 
  • A new dialog box will be displayed on the screen where you have to enter the folder ID of the folder whose files you want to be listed. 
  • To get the ID of a folder, head over to the main Google Drive webpage and find and open the folder you’re looking for. 
  • When you open the folder, copy the random string of letters from the address bar right after the forward slash in the web address, as shown in the example,  “https://drive.google.com/drive/u/0/folders/”.
  • Paste the folder ID in the Google Sheets tab’s pop-up box and click on OK. 

All files should begin listing automatically on a spreadsheet and depending on several files and subfolders, it will take a couple of minutes to be displayed.

All the files in that folder will be listed according to their full path within the Drive, name, type, date of creation, link, last updated, size, and the owner’s email address. 

List Files in a Folder and Subfolder on Google Drive
List Files in a Folder and Subfolder on Google Drive

Read How to Search Large Files on Google Drive

How to Highlight Files or Folders in Google Drive?

You can highlight specific files and folders in Drive to help you find them quickly. It also enables you to access the file easily if you are using it regularly.

Follow the below instructions to learn how to highlight files in Google Drive applications.

  • Open your laptop or PC and load your preferred browser. 
  • Move to the Google Drive website at drive.google.com
  • Once you are logged in, select any file or folder you want and draw out the contextual menu by right-clicking it.
  • Select Add to starred from the menu. The file will now be added to the Starred section in your Drive, which you can access by using the side menu. 

Read How to Make Files Public on Google Drive

How to Download a Google Sheets File as a PDF

You can easily convert a Google Sheets file to a PDF and download it using the toolbar in Google Sheets. Refer to the steps provided below to learn how to do that. 

  • Move to the Google Drive website at drive.google.com with your preferred browser.
  • Enter your details to access the Drive. 
  • Once logged in, click the New button on top of the side menu and select Google Sheets from it. 
  • You can also use a previously made Google Sheets document. 
  • Click on File in the Google Sheets toolbar and choose Download.
  • Select PDF from the menu, and your download should commence shortly. 

Read How to Download Google Drive Files on iPad

Conclusion

I hope this article helped you figure out how to create a list of files inside a folder on Google Drive. You do not need any prior coding knowledge to execute this method. Just follow the steps, and you should be good. 

You may face an error while working on Google Scripts, but you can restart again and follow the steps. Other than this, we have also mentioned the steps that will eventually help you to download Google Sheets as a PDF file to share it with other users who may or may not be on Google Drive.

You may like the following google drive tutorials: