Overall goal: Save my pdf in a folder which I define in a google sheets cell
I found this script here where I can save my google slides deck into a pdf which works great.
function pdf(){
var blob = DriveApp.getFileById("### Slide file ID ###").getBlob();
DriveApp.createFile(blob);
}
I would like to define the destination folder ID with referencing a cell in a spreadsheet. I imagine it would be a variation of the code below I found here How to reference a cell as the file or folder id for DriveApp? but I am just really lost now.
function myFunction() {
const ss = SpreadsheetApp.getActive();
const file_id = ss.getRange("Settings!B9").getValue(); // get value in "Settings!B9"
const folder_id = ss.getRange("Settings!C9").getValue(); // get value in "Settings!C9"
const googleDocTemplate = DriveApp.getFileById(file_id);
const destinationFolder = DriveApp.getFolderById(folder_id)
}
I would have imagined it being something like this but it still saves the pdf into the root folder of my drive
function pdf() {
const ss = SpreadsheetApp.openById("1j_Ltyx9e8Kb-ywLnJDLl5fzoWpfk3elD9xGvZX665DE");
const folder_id = ss.getRange("Sheet1!C9").getValue(); // get value in "Sheet1!C9"
const destinationFolder = DriveApp.getFolderById(folder_id)
var blob = DriveApp.getFileById("1Jac6DZweMjiikCF5qvyZc367PRyn1RoUSs6Osy_F4n0").getBlob();
DriveApp.createFile(blob);
}