google-apps-script

Google Spreadsheet - Show sheets depending on type of user

淺唱寂寞╮ 提交于 2021-02-02 09:30:15
问题 Is there a way, to make a certain sheet in Google Spreadsheets, be editable and accessible to a certain type of user, while not be accessible to another type of user? I currently have a Google App Script project, that allows a certain user to use an HTML form to input certain parameters, and a Google Spreadsheet is automatically created for him (thus, everything in the spreadsheet is created programatically). This new spreadsheet should have access by different "types" of users. A "type" of

How to debug identical strings that do not equal in google app script?

不问归期 提交于 2021-02-02 08:54:36
问题 I have 2 identical strings, they appear identical in the debugger (and Logger.log), but when I do string1 === string2 it returns false. How can I debug this? One of the string is a google drive file name, and one of the string is from a google sheet cell. I'm guessing there's an invisible character in one of the string but I have no way to see it. 回答1: Consider type of each variable typeof string1 === typeof string2 Consider length of each string string1.length === string2.length Loop through

How to debug identical strings that do not equal in google app script?

别来无恙 提交于 2021-02-02 08:53:02
问题 I have 2 identical strings, they appear identical in the debugger (and Logger.log), but when I do string1 === string2 it returns false. How can I debug this? One of the string is a google drive file name, and one of the string is from a google sheet cell. I'm guessing there's an invisible character in one of the string but I have no way to see it. 回答1: Consider type of each variable typeof string1 === typeof string2 Consider length of each string string1.length === string2.length Loop through

“com.au” string is displayed as “(class)” in Script Editor

我怕爱的太早我们不能终老 提交于 2021-02-02 03:45:10
问题 I need to store an Australian domain as a string. Australian domains end with ".com.au" Google Scripts seems to be displaying all instances of ".com.au" with "(class)". To reproduce, create a basic function in Google Apps Scripts as follows: function myFunction() { var x = "com.au"; console.log("x: " + x); var z = 1; //<--create break point here } Create a breakpoint at var z = 1 , and then debug the script. Actual Results: In the console (at breakpoint): x: (class) Expected Results: x: "com

“com.au” string is displayed as “(class)” in Script Editor

廉价感情. 提交于 2021-02-02 03:44:51
问题 I need to store an Australian domain as a string. Australian domains end with ".com.au" Google Scripts seems to be displaying all instances of ".com.au" with "(class)". To reproduce, create a basic function in Google Apps Scripts as follows: function myFunction() { var x = "com.au"; console.log("x: " + x); var z = 1; //<--create break point here } Create a breakpoint at var z = 1 , and then debug the script. Actual Results: In the console (at breakpoint): x: (class) Expected Results: x: "com

A query to get data of sheet in google app script

牧云@^-^@ 提交于 2021-01-29 22:27:00
问题 I add a small table To call the information on this sheet, I am doing it this way: var hojaCalculo = SpreadsheetApp.openById("1d3UuYJyHhsgfsdgshfghumtP4BX5bee2M"); var hojaDatos = hojaCalculo.getSheetByName("lista_sites"); var numColumns = hojaDatos.getLastColumn(); var ultimaFila = hojaDatos.getLastRow(); var row = hojaDatos.getRange(1, 1, ultimaFila, numColumns).getValues(); for (var i = 1; i < row.length; i++) { //the content and conditionals var id_site =row[i][0].toString(); } As I have

Install trigger for google app script in custom addon

倾然丶 夕夏残阳落幕 提交于 2021-01-29 21:53:32
问题 I am still very new to addons and I am having trouble to install triggers and have the related functions to run. Below is the function to add 1 "on open" trigger and 1 "on edit" trigger to the sheet. function addTriggers() { var sheet = SpreadsheetApp.getActiveSheet(); var triggers = ScriptApp.getUserTriggers(sheet); if(triggers.length!=2)// { ScriptApp.newTrigger('sheetOpen') .forSpreadsheet(sheet) .onEdit() .create(); ScriptApp.newTrigger('sheetEdited') .forSpreadsheet(sheet) .onOpen()

Google Script used by multiple User

允我心安 提交于 2021-01-29 21:37:12
问题 I have a Google Attendance form which triggers an apps script through spreadsheet connected to the form. My issue is that when around 1200 student will fill the form most probably at the same time, will the script overlap the data?? I saw google developer post where they have mentioned to lock the script for 30 seconds (lock.waitLock(30000); lock.releaseLock();) will it be enough to use the suggested method to prevent script from overlapping data of around 1200 students? I cant test the

Google App Script getActiveSheet returns leftmost sheet, not active sheet

限于喜欢 提交于 2021-01-29 20:57:37
问题 I guess this question is the most similar to my current question. But basically, I have a google sheets file that has several sheets along the bottom. I would like for the user to execute this script on whatever sheet they have open at the time. And like the previous question said according to this documentation, the active sheet is the one that is being displayed in the spreadsheet UI. I assume this means if I have the google sheets file open in another tab, that the sheet currently selected

How do I attach a working pdf of my google sheet to a draft email?

对着背影说爱祢 提交于 2021-01-29 20:40:38
问题 I have a script that was put together to open, rename, and export a google sheet as a pdf. Then that sheet would be added to an email draft. I have been using this script for two years without issue, but for some reason, the pdf attachment will no longer open. The error message I get is "Adobe Acrobat Reader could not open [File Name.pdf] because it is either not a supported file type or because the file has been damaged." I go directly to the google sheet and export as a pdf manually, I can