How to send offer letter from spreadsheet Data using appscript in hindi
दोस्तों आज के इस आर्टिकल में मैं आपको बताने वाला हूं कि आप किस तरीके से Appscript का (how to send offer letter from spreadsheet Data using appscript in hindi) इस्तेमाल करके किसी भी डाटा को PDF में कन्वर्ट कर सकते हैं |और PDF में कन्वर्ट करने के बाद उस डाटा को ईमेल भी कर सकते हैं | तो यह काम आप आप किस तरीके से Appscript में कर पाएंगे इसे आज हम सीखने वाले हैं |
Code.gs
function getData() {
let ws = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");
let lr = ws.getLastRow()-1;
let rangeValue = ws.getRange(2, 1, lr, 9).getDisplayValues();
rangeValue.forEach(r => {
var template = {
date: r[0],
name: r[1],
jobTitle: r[2],
salaryMonth: r[3],
annualCtc: r[4],
startDate: r[5],
startTime: r[6],
reportingPerson: r[7],
offerAcceptanceDate: r[8],
}
pdfFile(template);
});
}
function pdfFile(template) {
let tmpfol = "1ZawN1RcbrrO9k_jg1DEcVEaqApYRVGz7";
let pdfFol = "1DwAh5PNvj20Be8pBjuNm6Jp-Z_VfcjQ-";
let docFile = "1a3buIm6vYdE3LbSzEb2IRJyu0TkaAt8EWmgvqkR1IHM";
let dummyFile = DriveApp.getFileById(docFile).makeCopy(tmpfol).setName("TempFile");
let openFile = DocumentApp.openById(dummyFile.getId());
let body = openFile.getBody();
body.replaceText("{Date}",template.date);
body.replaceText("{Name}", template.name);
body.replaceText("{Job Title}", template.jobTitle);
body.replaceText("{Salary per month}", template.salaryMonth);
body.replaceText("{Annual CTC}", template.annualCtc);
body.replaceText("{Desired starting date}", template.startDate);
body.replaceText("{Desired to start time}", template.startTime);
body.replaceText("{Name of person to report on start date}", template.reportingPerson);
body.replaceText("{Last date for offer acceptance}", template.offerAcceptanceDate);
openFile.saveAndClose();
let getBlob = dummyFile.getAs('application/pdf').setName(template.name + " " + template.date);
DriveApp.createFile(getBlob).moveTo(DriveApp.getFolderById(pdfFol));
DriveApp.getFolderById(tmpfol).removeFile(dummyFile);
sendEmail(template, getBlob);
}
function sendEmail(template, blob) {
let emailBody = {
to: "dme1@thegoldberg.in",
subject: "Offer Letter",
body: "Hello" + " " + template.name +" "+ "Greeting | This is a offer letter |",
attachments: [blob]
}
MailApp.sendEmail(emailBody);
}
Get File For Practice
1 टिप्पणियाँ
we like this information.
जवाब देंहटाएंLetest make money online, Technology, education, internet se pese kese kamaye hindi me
Thanks For Message Me if any issue please feel free to contact