我有一个包含5列的Google表格(名字,地址,SKU,报价,状态).
我有一个应用程序脚本函数(createQuote),它从google工作表行查看上述变量的值,并创建一个google文档引用,将变量替换为值.
我使用Zapier在我上面的google工作表中插入行.
正在努力的方面 - :当通过zapier(Google Sheet API调用)插入新行时,我需要一种方法来触发我的createQuote函数.
我试过玩触发器,但无法做到,任何帮助表示赞赏.
谢谢
这是我的功能代码 -
function quoteCreator(){
docTemplate = "googledocidgoeshere"
docName = "Proposal"
var sheet = SpreadsheetApp.getActive().getSheetByName("Main")
var values = sheet.getDataRange().getValues()
var full_name = values[1][0]
var copyId = DriveApp.getFileById(docTemplate).makeCopy(docName+" for "+full_name).getId()
// Open the temporary document
var copyDoc = DocumentApp.openById(copyId);
// Get the document’s body section
var copyBody = copyDoc.getActiveSection();
// Replace place holder keys/tags,
copyBody.replaceText("keyFullName", full_name);
copyDoc.saveAndClose();
// Convert temporary document to PDF by using the getAs blob conversion
var pdf = …Run Code Online (Sandbox Code Playgroud) 我从API调用获取日期时间,如下所示:
2017-11-21T20:23:26 + 0000
现在,我想将其与今天的日期进行比较,并计算天数的差额,我该如何在Google Apps脚本中做到这一点。
谢谢您的帮助。