🌟 Streamline Your Google Drive with this Simple Script! 🚀
Struggling with a cluttered Google Drive? Here's a lifesaver script that automates the process of listing all your Google Drive folders and their links directly into a Google Sheet. It's a fantastic tool for educators, project managers, or anyone dealing with a large number of folders!
🔍 What This Script Does:
It starts from a specified main folder in your Google Drive.Recursively searches through all its subfolders.Lists each folder's name along with its direct link in a Google Sheet.🛠️ The Script Breakdown:
function listAllSubfolders() { var mainFolderId = 'YOUR_FOLDER_ID'; // Put your main folder ID here var mainFolder = DriveApp.getFolderById(mainFolderId); var data = []; var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); sheet.clear(); sheet.getRange('A1').setValue('Listing all subfolders...'); function getAllSubfolders(folder, depth) { var subFolders = folder.getFolders(); while (subFolders.hasNext()) { var subFolder = subFolders.next(); var prefix = '>'.repeat(depth); // Indents to show folder hierarchy data.push([prefix + subFolder.getName(), subFolder.getUrl()]); getAllSubfolders(subFolder, depth + 1); } } getAllSubfolders(mainFolder, 0); if (data.length > 0) { sheet.getRange(2, 1, data.length, 2).setValues(data); // Lists data in the sheet } else { sheet.getRange('A1').setValue('No subfolders found'); } sheet.getRange('B1').setValue('Complete');}📌 How to Use This Script:
Find Your Folder ID:Go to Google Drive and open the folder you want to list.Look at the URL; it will look something like drive.google.com/drive/folders/YOUR_FOLDER_ID.Copy the YOUR_FOLDER_ID part.Set Up the Script:Open a new Google Sheet.Click Extensions > Apps Script.Delete any code in there and paste the script above.Replace 'YOUR_FOLDER_ID' in the script with your actual folder ID.Run the Script:Click the disk icon to save, then the play button to run.Authorize the script if prompted.Return to your Google Sheet, and you'll see it populating with folder names and links!🎉 Benefits:
Saves time and energy in manually tracking folders.Creates a neat, accessible directory of your Google Drive folders.Easily customizable for various needs.📢 Spread the word and help others bring organization to their digital life! This script is a small step towards big productivity gains!
#GoogleDriveTips #ProductivityTools #TechHacks #GoogleAppsScript #OrganizeYourLife





