google-apps-script

Google Spreadsheet Script onChange event not firing

空扰寡人 提交于 2020-12-09 03:23:31
问题 I am trying to fire an onChange event and it is not working. I have the following simple code: function onChange(){ Logger.log("onChange event fired"); } function onEdit(){ Logger.log("onEdit event fired"); } https://developers.google.com/apps-script/understanding_events According the this document, the onChange event should be fired when a row is inserted. It does not get fired. The onEdit function gets fired when you manipulate a cell, but I need an event to be fired when the user inserts a

Google Spreadsheet Script onChange event not firing

丶灬走出姿态 提交于 2020-12-09 03:21:01
问题 I am trying to fire an onChange event and it is not working. I have the following simple code: function onChange(){ Logger.log("onChange event fired"); } function onEdit(){ Logger.log("onEdit event fired"); } https://developers.google.com/apps-script/understanding_events According the this document, the onChange event should be fired when a row is inserted. It does not get fired. The onEdit function gets fired when you manipulate a cell, but I need an event to be fired when the user inserts a

How to use global variables while avoiding permission errors?

吃可爱长大的小学妹 提交于 2020-12-07 16:41:55
问题 See the below example, function doSomething1(){/*needs ss*/const ss = SpreadsheetApp.openById(/*SPREADSHEET_ID*/);} function doSomething2(){/*needs ss*/const ss = SpreadsheetApp.openById(/*SPREADSHEET_ID*/);} function doItAll(){ doSomething1(); doSomething2(); } Instead of calling Spreadsheet in both functions, this could be simplified using globals as const ss = SpreadsheetApp.openById(/*SPREADSHEET_ID*/); function doSomething1(){/*do something with ss*/} function doSomething2(){/*do

How to use global variables while avoiding permission errors?

风格不统一 提交于 2020-12-07 16:38:55
问题 See the below example, function doSomething1(){/*needs ss*/const ss = SpreadsheetApp.openById(/*SPREADSHEET_ID*/);} function doSomething2(){/*needs ss*/const ss = SpreadsheetApp.openById(/*SPREADSHEET_ID*/);} function doItAll(){ doSomething1(); doSomething2(); } Instead of calling Spreadsheet in both functions, this could be simplified using globals as const ss = SpreadsheetApp.openById(/*SPREADSHEET_ID*/); function doSomething1(){/*do something with ss*/} function doSomething2(){/*do

How to solve error when adding big number of tables

笑着哭i 提交于 2020-12-07 13:35:44
问题 I have this Google Script where I am creating a document using a template table that lives in another document. The new document will have a number of small tables (like cards) in it. The code bellow works fine for 100, 200 tables and it finishes in less than 10 seconds. But it fails for more than 500 tables. There is no error message in the Executions window. I have tried the saveAndClose() function (commented out) but the error continues and it just takes longer to run. I ran out of ideas

How to solve error when adding big number of tables

你说的曾经没有我的故事 提交于 2020-12-07 13:30:26
问题 I have this Google Script where I am creating a document using a template table that lives in another document. The new document will have a number of small tables (like cards) in it. The code bellow works fine for 100, 200 tables and it finishes in less than 10 seconds. But it fails for more than 500 tables. There is no error message in the Executions window. I have tried the saveAndClose() function (commented out) but the error continues and it just takes longer to run. I ran out of ideas

How to solve error when adding big number of tables

北城余情 提交于 2020-12-07 13:25:46
问题 I have this Google Script where I am creating a document using a template table that lives in another document. The new document will have a number of small tables (like cards) in it. The code bellow works fine for 100, 200 tables and it finishes in less than 10 seconds. But it fails for more than 500 tables. There is no error message in the Executions window. I have tried the saveAndClose() function (commented out) but the error continues and it just takes longer to run. I ran out of ideas

How to solve error when adding big number of tables

雨燕双飞 提交于 2020-12-07 13:23:12
问题 I have this Google Script where I am creating a document using a template table that lives in another document. The new document will have a number of small tables (like cards) in it. The code bellow works fine for 100, 200 tables and it finishes in less than 10 seconds. But it fails for more than 500 tables. There is no error message in the Executions window. I have tried the saveAndClose() function (commented out) but the error continues and it just takes longer to run. I ran out of ideas

How to fix error - Invalid argument: file.contentType, when creating new Google Sheet

丶灬走出姿态 提交于 2020-12-07 04:59:04
问题 I am trying to create a new Google Sheet in a created folder, but am having issues with the content Type. I have searched for this error but haven't found anything. Most searches come up with a MimeType error, but I don't think that's the issue. Below is the code I'm using: var ss = SpreadsheetApp.getActiveSpreadsheet(); var newFolder = DriveApp.getFolderById("MyID").createFolder("New Folder"); newFolder.createFile("myFileName",ss,MimeType.GOOGLE_DOCS); Whenever I run this in my spreadsheet,

sha3-256 of a cell text in Google Spreadsheet

守給你的承諾、 提交于 2020-12-07 04:53:18
问题 I know you can do sha1 and others on google sheets but is there a way to do sha3-256 secret: test123 hash 3054762b0a8b31adfe79efb3bc7718624627cc99c7c8f39bfa591ce6854ac05d 回答1: You want to retrieve the hash of SHA3-256 type from the text of test123 as the HEX data. You want to put the value to a cell of Spreadsheet. You want to achieve this using Google Apps Script. You want to use the function as the custom function. If my understanding is correct, how about this answer? Issue: In the current