Try to create a document in the same folder of the presentation but I seem to need to have the ID or name to get the ID of the parent folder and I cant seem to find any thing that does that.
Nothing that I tried worked I.e.
function getparentfolderid(){
Var ss = slidesapp.getactivepresentation();
Var tt = slidesapp(ss.getid())
Var file = driveapp.getfilebyid(ss);
var folder = file.getparents();
var parentfoldername = folder.next().getname();
logger.log(parentfoldername);
}
From I need the ID of the folder that my current presentation is in.
of your reply, if you want to retrieve the parent folder ID of the active presentation, how about the following sample script?
Please copy and paste the following script to the script editor of Google Slide and save the script.
function sample() {
const s = SlidesApp.getActivePresentation();
const fileId = s.getId();
const file = DriveApp.getFileById(fileId);
const parent = file.getParents().next();
const parentFolderId = parent.getId();
console.log(parentFolderId); // Show parent folder ID in the log.
const parentFolderName = parent.getName();
console.log(parentFolderName); // Show parent folder name in the log.
}