So my script takes 5 minutes to run. It is copying and pasting a file into a folder, then replaces text at the words with {{}}.
function b(row,sheet){
return sheet.getRange(row,sheet.getMaxColumns()).getValue()
}
function makedoc(){
let forma = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("forma");
let datab = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("baza");
let rows = forma.getRange(1,2,forma.getMaxRows()).getValues();
let googleDocTemplate = DriveApp.getFileById("notrevealing");
let destinationFolder = DriveApp.getFolderById("not revealing");
let copy = googleDocTemplate.makeCopy(rows[1]+" "+rows[2]+" File", destinationFolder);
let doc = DocumentApp.openById(copy.getId());
let body = doc.getBody();
body.replaceText("{{date1}}", Utilities.formatDate(new Date(), "GMT+2", "dd.MM/yyyy"));
body.replaceText("{{date2}}", Utilities.formatDate(new Date(), "GMT+2", "dd.MM.yyyy"));
body.replaceText("{{date3}}", Utilities.formatDate(new Date(), "GMT+2", " dd.MM "));
body.replaceText("{{name}}",b(2,forma));
body.replaceText("{{name2}}",b(3,forma));
body.replaceText("{{name3}}",b(4,forma));
body.replaceText("{{firma}}",b(25,forma));
body.replaceText("{{price}}",b(23,forma));
body.replaceText("{{price2}}",word(b(23,forma)));
body.replaceText("{{price3}}",String(b(23,forma)+" dl."));
body.replaceText("{{price4}}",String(word(b(23,forma))+" dl."));
body.replaceText("{{a2}}",b(9,forma));
body.replaceText("{{a3}}",b(10,forma));
body.replaceText("{{a4}}",b(11,forma));
body.replaceText("{{a5}}",b(12,forma));
body.replaceText("{{a6}}",b(13,forma));
body.replaceText("{{a7}}",b(14,forma));
body.replaceText("{{a8}}",b(15,forma));
body.replaceText("{{a9}}",b(15,forma));
body.replaceText("{{a10}}",b(16,forma));
body.replaceText("{{a11}}",b(17,forma));
body.replaceText("{{a12}}",b(18,forma));
body.replaceText("{{egn}}",b(7,forma));
body.replaceText("{{number}}",b(5,forma));
body.replaceText("{{address}}",b(6,forma));
body.replaceText("discount",b(24,forma));
body.replaceText("pay",b(23,forma)-b(24,forma));
body.replaceText("discount2",word(b(24,forma)));
body.replaceText("pay2",word(b(23,forma)-b(24,forma)));
}
If you ask about why I do every a thing myself, I tried using for but it didn't work.