Google Drive is a powerful cloud storage service provided by Google for free. We can easily add, modify, delete files present in Google Drive. We can find docs, sheets, and slides by searching File Title, File Contents, etc. Using Google Drive for a while, you find useful of getting a list with URL of all those files and folder in Google Sheet so that you can track content of google drive. Then you are in right place.
In this article I will explain how to List all Google Drive links of Files/Folders to Google Sheet? or How do I export a list from Google Drive? or How do I export a Google Drive folder structure?. So without wasting time let start.
Google Drive has a powerful tool called Google Apps Script. This allows you to create a script that can add, modify and find files and folders present in google drives.We can list all Google Drive links of Files /Folders to Google Sheets with the help of these Google Apps Script.
Create new Google Sheets
Create a new Google Spreadsheet file where we will create a list of google drive files and folders.
In my case, I have created a sheet name "GoogleDriveList"
In a sheet title bar ,select "Tools" >> "Script Editor".
This will open Script Editor.
In the Script Editor, delete everything from the textbox and paste the following script.
Source Code of this is located here. I have done a little modification.
Click on the Edit icon.
. Goto the same Google Sheets File and refresh the page.
Then you will get the "List Files/Folders" menu, click on it, and select the "List All Files and Folders" item.
. Popup will appear and there type folder Id.
How to get FolderId?
To get folderId, first, go to the desired folder in google drive whose files/folders you want to list and then copy the random character just after 'https://drive.google.com/drive/folders/' as shown below and then paste it in the above popup.
. Press the Ok button in the popup.
Then all your folders, files links are listed in google docs one by one. Depending on the number of files and folders of Google Drive, it may take some time to display all the files.
The output looks like this: