u
Size: a a a
u
u
ИД

=ARRAYFORMULA(IFNA(VLOOKUP(FILTER(A2:A;A2:A<>"");FILTER('Лист2'!B:C;'Лист2'!A:A='Лист2'!B:B);2;0);0))A
АТ
Товарищ Виталий подсказывает, что стоит заметить: библиотека не подойдёт, чтобы спрятать код.MS
АТ
АС
EN
u
A
u
4377 7237 4010 39021uSFLGCTdKHLwMaHjTRdhb6CdkfASGPCoTXY1cJBWAZ1qi2kAEPLtgaUsHGwNKN8WYEA
АС
function toPdf(ss, shNameRange) {
let [shName, range] = shNameRange.split("|").map(g => g.trim());
const sh = ss.getSheetByName(shName);
let rangeLink;
if (range) {
range = range.split(":");
const [r1, c1] = cellA1ToIndex(range[0]);
const [r2, c2] = cellA1ToIndex(range[1]);
rangeLink = `&r1=${r1}&c1=${c1}&r2=${r2}&c2=${c2+1}`
}
var url = "https://docs.google.com/spreadsheets/export?id=" + ss.getId()
+ "&gid=" + sh.getSheetId()
+ "&exportFormat=pdf"
+ (rangeLink ? rangeLink : '')
+ '&size=A4' //A3/A4/A5/B4/B5/letter/tabloid/legal/statement/executive/folio
+ '&portrait=true' //true= Potrait / false= Landscape
+ '&fitw=true' //fit window or actual size
+ '&top_margin=0.1' //All four margins must be set!
+ '&bottom_margin=0.1' //All four margins must be set!
+ '&left_margin=0.1' //All four margins must be set!
+ '&right_margin=0.1' //All four margins must be set!
+ '&gridlines=false' //true/false
+ '&printnotes=false'
+ '&horizontal_alignment=CENTER' //LEFT/CENTER/RIGHT
+ '&vertical_alignment=TOP' //TOP/MIDDLE/BOTTOM
+ '&printtitle=false' //true/false
+ '&sheetnames=false' //true/false
+ '&fzr=false' //true/false
+ '&fzc=false' //true/false
+ '&attachment=false' //true/false
//другие параметры превращение в PDF смотрите здесь: https://stackoverflow.com/questions/46088042/margins-parameters-for-spreadsheet-export/46312255#46312255
var token = ScriptApp.getOAuthToken();
return response = UrlFetchApp.fetch(url, {
headers: {
'Authorization': 'Bearer ' + token
}
}).getBlob();
}
function createPDF(){
const sheetName = "Ф7П";
const PDF_folder = DriveApp.getFolderById("11uG_ak-KlDknMxdDSiQVz-j-eWD_sU5R2");
// const TEMP_FOLDER = DriveApp.getFolderById("11uG_ak-KlDknMxdDSiQVz-j-eWD_sU5R2");
// const PDF_Template = DriveApp.getFileById("11l9AovqPWxW9-mVyPlPcVjJXXtna1CVTA31IrDg31i7g");
// const newTempFile = PDF_Template.makeCopy(TEMP_FOLDER);
// Открываем файл с шаблоном формы Ф7П
// const ss0 = SpreadsheetApp.openById(PDF_Template.getId());
const ss0 = SpreadsheetApp.getActiveSpreadsheet();
// Открываем настройки
const sh0 = ss0.getSheetByName(sheetName);
// Блок настроек в файле с шаблоном
const ot_kogo = 'V30';
var student_fio = "";
var r = ['eeeeeeeeeeeeeeeeee', 'rrrrrrrrrrrrrrrrrrrr', 'ttttttttttttttttttttttt'];
for(x=0; x<r.length; x++){
student_fio = String(r[x]);
Logger.log( student_fio );
sh0.getRange(ot_kogo).setValue( student_fio );
sh0.getRange(ot_kogo).activateAsCurrentCell();
Utilities.sleep(20000);
var blob = toPdf(ss0, "Ф7П");
var pdfFile = PDF_folder.createFile(blob).setName( student_fio + ".pdf" );
student_fio = "";
}
}EN
EN
АС
u