I can duplicate the activespreadsheet to a new file on my Google Drive with App Script ok. However, it copies the attached scripts. How can I duplicate the spreadsheet without it bringing in all the Apps Scripts? I can duplicate the spreadsheet ok. But when I open the newly duplicated file, it has all my scri…
Tag: google-apps-script
How can I search an object for certain object properties case insensitively?
I receive an object from the Gmail API and I need to extract certain properties. The problem is that sometimes the object property I am looking for in the original object is written in capital letters and sometimes not (e.g. Content-Id instead of Content-ID). var ob = headers.find(({ name }) => name == …
How can I make an installable onEdit trigger on button press?
So, I know the onEdit functions triggers when there is an Edit in the document. Does it also trigger when a script edits the document? I specifically need an installed.onEdit function, but I only want it to trigger when a button was pressed. To test it, I assigned to a drawing a script that inserts a timestam…
Sum of Elements in 2D array
I have a 2d array and was able to pass it from code.gs to JavaScript. The next thing I want to do is to sum all elements or numbers example in column 2. I’ve seen this code while searching online but it add all elements in the array. I don’t know how to personalize it to meet my needs. `
Displaying data from a google sheet onto an html table
As the title says, I’m having some issues properly displaying data from a google spreadsheet onto a table in HTML. For context, what my program is supposed to do is: when the button ‘New Alert’ is pressed, a form pops up that allows for user input. After inputting all the information that th…
How to set a tag text value from Google Apps Script with JavaScript?
How are the elements foo and bar set to the values for their corresponding variables? html: code: Server side logs show foo and bar values when uncommented. However, there seems no output from console.log(“some text”); from within the function defined on the HTML page. Answer If you are trying to …
Tabular data manipulation in Google Apps Script
I’d like to be able to import data from different spreadsheets, do some arbitrarily complex operations on it programmatically (filtering, averaging, removing/adding columns, etc) and then save it back to the main spreadsheet. I’m already able to import data from other spreadsheets, but I am curren…
How to get the number of word occurrences in a 2D array?
I’ve found a solution that gives the correct result when the word is at the same index, within each of the array elements, but in the case below, the term/word searched can be anywhere in the element (beginning or end). Expected result: Here’s the attempt using the solution above: Appreciate your …
FileReader not defined in Apps Script
I am trying to use FileReader.readDataAsUrl() to send a blob object in a JSON file. But I keep getting the error Reference Error: “FileReader” is not defined. Is there a way that I need to implement it since I am using Apps Script? I see an issue someone had where they set their sandbox to IFRAME …
How can i skip “undefined”?
I want to create a script, which will be grouping all not empty rows. But, i have problem with checking getDepth or getRange when group doesn’t exist. I get “undefined” and i can’t create easy check like “if getDepth < 0 or “undefined”” because script stoppin…