Google Apps Script that you can use to get the count of all files in a Google Drive folder and write it to a Google Sheets spreadsheet
function getFileCount() {
// Get the folder ID of the folder you want to count 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 count of the files in the folder
var fileCount = 0;
while (files.hasNext()) {
files.next();
fileCount++;
}
// Get the active sheet in the spreadsheet
var sheet = SpreadsheetApp.getActiveSheet();
// Write the header row in the sheet
sheet.appendRow(["File Count"]);
// Write the file count in the sheet
sheet.appendRow([fileCount]);
}