I am generatinf a pdf file, using date mentionned in SpreadSheet. Nevertheless, I am looking to change the date format, to be displayed as (french) :
dddd, dd MMMM yyyy
Lundi, 09 septembre 2022
I tried some to work out the code, but it didn't succeed.
function CreateBulkPDFs() {
const DocFile = DriveApp.getFileById("1JeQYnMoXCJTai0F8LUPCt3xRCINzbO97WNP38Ax-u-w");
const DossTEMP = DriveApp.getFolderById("1h62bRQVhfBFsPU6lI1L2Xb7K6ANXrYuA");
const EmplacementPDF = DriveApp.getFolderById("1P5xdUZQz0fGObAYWFqk3jgIpA1T1hTlO");
const CurrentSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("ADMISSIBILITÉ SÉLECTION");
//const timeZone = AdsApp.currentAccount().getTimeZone();
const DATE = CurrentSheet.getRange("E5").getValue();
//const DateString = Utilities.formatDate(DATE, timeZone, 'MMMM dd, yyyy Z');
//console.log(Utilities.formatDate(DATE, 'America/New_York', 'MMMM dd, yyyy'));
const FONCTION = CurrentSheet.getRange("C4").getValue();
const UNITE = CurrentSheet.getRange("N4").getValue();
const ANCIENNETE = CurrentSheet.getRange("N5").getValue();
//const AncString = Utilities.formatDate(ANCIENNETE, timeZone, 'MMMM dd, yyyy Z');
var NomMatr = CurrentSheet.getRange("A8:N" + CurrentSheet.getLastRow()).getValues();
NomMatr.forEach(([check, ...row], i) => {
const NOM = row[3];
const MATRICULE = row[5];
if (check === true) {
CreatePDF(DATE,NOM,MATRICULE,FONCTION,UNITE,ANCIENNETE,"Appel d'intérêt_Comblement titulaire 4.05_" + NOM,DocFile,DossTEMP,EmplacementPDF);
try {
CurrentSheet.getRange("A" + (i + 8)).uncheck();
}catch(err) {
}
}
});
}
EDIT:
I Modified some lines:
const DATE = CurrentSheet.getRange("E5").getValue();
const FormattedDATE = Utilities.formatDate(DATE, "GMT", "EEEEE, dd MMMM yyyy");
Pattern Examples