Reputation: 462
let's say I know the folder ID
var folderId = '************ID************';
I would like to get the name of the folder with that folderId
. I tried to use getName()
and combine it with this code without success.
It sounds like a basic task, but I can't figure out the working code. Is it even possible? Any ideas?
Upvotes: 0
Views: 3249
Reputation: 462
Okay, the solution seems to be quite easy:
function folderName() {
var folderId = '************ID************',
folder = DriveApp.getFolderById(folderId);
Logger.log('Folder name: ' + folder.getName());
};
I hope this will help noobs like me.
Upvotes: 0
Reputation: 4344
You don't need to use the Folder Iterator. You can call the folder directly:
var folderId = "yourFolderIdString999"
var name = DriveApp.getFolderById(folderId).getName() // returns name string
You can also call the folder ID directly in the name
variable rather than using an ID variable (unless you need it in other places).
Upvotes: 1