Я хочу сделать ту же концепцию, что и обычное слияние, но используя 2 листа Google.Один имеет входы, а другой должен быть заполнен.Шаблон: https://docs.google.com/spreadsheets/d/1iArfClgEMfwKQbEV_irwIbVD72hNI0JWCgtlizZKaGg/edit?usp=sharing
Данные: https://docs.google.com/spreadsheets/d/1o6Vag8pNhJgKdXK63Ic5sU_UcdbeJGkLOublIuTjOnY/edit?usp=sharing
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [
{name: "Invoice from selection", functionName: "generateInvoice"},
];
ss.addMenu("Invoice", menuEntries);
}
function generateInvoiceForRow(index) {
var templateid = "1iArfClgEMfwKQbEV_irwIbVD72hNI0JWCgtlizZKaGg"; // this is the template file id. You can find this in the URL of the google document template. For example, if your URL Looks like this: https://docs.google.com/document/d/1SDTSW2JCItWMGkA8cDZGwZdAQa13sSpiYhiH-Kla6VA/edit, THEN the ID would be 1SDTSW2JCItWMKkA8cDZGwZdAQa13sSpiYhiH-Kla6VA
var FOLDER_NAME = "NAME OF DESTINATION FOLDER"; // Enter the name of the folder where you want to save your new documents. for example, this could be "Output Folder".
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('inputs');
var invoice = ss.getSheetId("1iArfClgEMfwKQbEV_irwIbVD72hNI0JWCgtlizZKaGg")
if (index===1) }
else {
var Name = sheet.getRange('D' + index).getValue(),
Email = sheet.getRange('C' + index).getValue(),
Address = sheet.getRange('E' + index).getValue();
ss.getRangeByName('client').setValue(Name + ' ' + Email+ '\n' + Address);
appendToDoc(doc, newDoc)
var usernamefordoctitle = sheet.getRange(2, 1, 1, 1).getValues();
var newDoc = SpreadsheetApp.create(current row " +clientname");
var file = DriveApp.getFileById(newDoc.getId());
var folder = DriveApp.getFolderById("1BGzhaYlSIRn2yHOED-U4qO04MDZHmgOc"); // INSERT the destination folder ID. Once again, this can be found in the URL once you have the folder openned in your browser
folder.addFile(file)
for (var i in data){
var row = data[i];
;
doc.saveAndClose()
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [
{name: "Invoice from selection", functionName: "generateInvoice"},
];
ss.addMenu("Invoice", menuEntries);
}
function generateInvoiceForRow(index) {
var templateid = "1iArfClgEMfwKQbEV_irwIbVD72hNI0JWCgtlizZKaGg"; // this is the template file id. You can find this in the URL of the google document template. For example, if your URL Looks like this: https://docs.google.com/document/d/1SDTSW2JCItWMGkA8cDZGwZdAQa13sSpiYhiH-Kla6VA/edit, THEN the ID would be 1SDTSW2JCItWMKkA8cDZGwZdAQa13sSpiYhiH-Kla6VA
var FOLDER_NAME = "NAME OF DESTINATION FOLDER"; // Enter the name of the folder where you want to save your new documents. for example, this could be "Output Folder".
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('inputs');
var invoice = ss.getSheetId("1iArfClgEMfwKQbEV_irwIbVD72hNI0JWCgtlizZKaGg")
if (index===1) }
else {
var Name = sheet.getRange('D' + index).getValue(),
Email = sheet.getRange('C' + index).getValue(),
Address = sheet.getRange('E' + index).getValue();
ss.getRangeByName('client').setValue(Name + ' ' + Email+ '\n' + Address);
appendToDoc(doc, newDoc)
var usernamefordoctitle = sheet.getRange(2, 1, 1, 1).getValues();
var newDoc = SpreadsheetApp.create(current row " +clientname");
var file = DriveApp.getFileById(newDoc.getId());
var folder = DriveApp.getFolderById("1BGzhaYlSIRn2yHOED-U4qO04MDZHmgOc"); // INSERT the destination folder ID. Once again, this can be found in the URL once you have the folder openned in your browser
folder.addFile(file)
for (var i in data){
var row = data[i];
;
doc.saveAndClose()
newDoc.saveAndClose()
DriveApp.getFileById(docid).setTrashed(true);
}
ss.toast("Templates has been complied.);
}
}