Google Apps Script that you can use to get the file names of all files in a Google Drive folder and write them to a Google Sheets spreadsheet
function getFileNames() {
// Get the folder ID of the folder you want to list files from
var folderId = "your_folder_id";
// Get the folder using the ID
var folder = DriveApp.getFolderById(folderId);
// Get all the files in the folder
var files = folder.getFiles();
// Get the active sheet in the spreadsheet
var sheet = SpreadsheetApp.getActiveSheet();
// Write the header row in the sheet
sheet.appendRow(["File Name"]);
// Loop through all the files in the folder
while (files.hasNext()) {
var file = files.next();
// Write the file name in the sheet
sheet.appendRow([file.getName()]);
}
}