Questions tagged [google-apps-script]

Use for questions about Google Apps Script, Google's server side Javascript-based cloud scripting platform for automating tasks across Google products and third-party services. Use in addition to relevant product-specific (e.g. [google-sheets], [google-docs]) or API-specific (e.g. [google-drive-api]) tags where applicable

Google Apps Script Logo

Google Apps Script is a server side Javascript-based cloud scripting platform for automating tasks across Google products and third-party services.

Here you'll find links to wonderful resources, helpful tips on asking better questions, and secret chat room links.


How to ask?

General information:
  • Well researched questions are better received by the community. You can start researching by reading or searching the issue in the official developer documentation and the FAQ. Don't ask questions because you want to know the answer, ask questions because you want others to know the answer!

  • Avoid asking questions that are goal oriented. Split up your goal into smaller questions and ask them one by one. For eg, avoid asking "How to create a Google sheet with sports information from this API?". Instead, start writing your code and if you run into a problem getting the correct information, ask "How to send the correct authentication request to this sports API using my username and password, as sending it directly gives me 404?". The latter is a programming question. The former is a business project. Asking volunteers to do unpaid work is frowned upon. See Why is "Can someone help me" not a actual question?

  • Always provide minimal reproducible example. The code should be as minimal as possible, preferably within ten to fifteen lines of code. This requires you to debug your code and takes effort on your part. You can start the process by "Starting from scratch". Don't start with where you are and start reducing. Start from scratch and start adding one by one. See minimal reproducible example.

  • If you reach this point and you are still struggling on how to fix / improve your first question, please read What is the proper way to approach Stack Overflow as someone totally new to programming?. You might also post a question on Meta Stack Overflow including a link to your post. If you get an error when trying to post to Meta, please checkout I'm asking a question about my own post, but I'm still prompted that I need 5 reputation to post here. What gives?.

Specific information:

Tag usage guidance

This is a summary of tags related to Google Apps Script and how to use them in the question being asked.


Community Chat Room

Note: Stack Overflow chat requires a minimum reputation of 20 or be "invited" by a Stack Overflow moderator.


Official Resources


Community Resources


Best Practices


FAQ:

:

53079 questions
5
votes
2 answers

Google Apps Script find a value in an Array

I can't figure out how to check if a value exists in an Array. I assumed this should be trivially simple, but can't get there. I have this code: function findPlayer() { //This section gets the values from the first row of all the columns var ss =…
Dan Howard
  • 176
  • 2
  • 6
  • 16
5
votes
1 answer

Prevent editing of cells while script is running

I have a small Google Apps script that runs for a couple of secounds after certain cells within a spreadsheet are edited. My question is if it's possible to prevent the current user of doing further changes to the spreadsheet while the script is…
5
votes
3 answers

Google App Script Adding one Day to a date

I can't figure out how to add one day to a date in Google App Script. I have this script: function dateTest() { var testDate = new Date(); var secondDate = new Date(testDate.getDate()+1); Logger.log(testDate); Logger.log(secondDate); } Which…
Dan Howard
  • 176
  • 2
  • 6
  • 16
5
votes
2 answers

Google Script: Play Sound when a specific cell change the Value

Situation: Example Spreadsheet Sheet: Support Column: H has the following function "=IF(D:D>0;IF($B$1>=$G:G;"Call";"In Time");" ")" that changes the value depending on the result. Problem: I need to: Play a sound when a cell in column H…
LAD Service Desk
  • 289
  • 5
  • 14
  • 27
5
votes
1 answer

Run Google App Script from web page

I know how to write a simple app script that (once published) provide a simple form (name and message) that push values in a Google Spreadsheet. My question is: how can I run the script from my site? Can I build an html form and when I submit the…
5
votes
3 answers

How to find and remove blank paragraphs in a Google Document with Google Apps Script?

I am working with Google documents that contain hundreds of empty paragraphs. I want to remove these blank lines automatically. In LibreOffice Writer you can use the Find & Replace tool to replace ^$ with nothing, but that didn't work in Google…
Rens Jaspers
  • 113
  • 1
  • 7
5
votes
1 answer

How do I add a comment to a Google Doc with Google Apps Script

I was looking at the documentation and found no way to add a comment using Google Apps Script. After scrolling a bit, I found out that the addComment() function was deprecated. Is there currently any way to add a comment to a Google Doc using GAS…
Pro Q
  • 4,391
  • 4
  • 43
  • 92
5
votes
1 answer

Send Form with MailApp after fetching html. Embed Google Form into email. Generated email contains only text

I want to embed a Google form in an email and send it with MailApp. I'm attempting to use code found at: https://stackoverflow.com/a/23671529/4305236: var form = FormApp.create('New Form'); .... var url = form.getPublishedUrl(); var response =…
tmkiefer
  • 215
  • 1
  • 2
  • 10
5
votes
2 answers

Writing file to Application Data Folder on Add-ons from Google App Script server code

As mentioned in this document about storing application data, I would like to make it possible from a Google App Script Add-on server code. I was able to create an arbitrary file into my google root drive folder this way. …
darul75
  • 343
  • 6
  • 21
5
votes
1 answer

Google Apps Script - Permanent Caching

I have a sheet with a lot of custom functions calls. I would like to cache results permanently. Until now, I've used cache service, but it is limited to six hours. Is there a way to cache results permanently ? I read in the comments here, that it…
5
votes
1 answer

Checking if one date is greater than the other using Google Script

I am trying to check if one date is greater than another date using google script. I am extracting a date from the spreadsheet and formatting it. Then I check it against today's date. If today's date is less than the extracted date, some…
Pallavi Prasad
  • 577
  • 2
  • 9
  • 28
5
votes
1 answer

"make this a quiz" and create answer key using FormApp in google spreadsheet script

I wrote a google spreadsheet script that parses a spreadsheet and creates a form with the data. Once the form is created, I can manually go to the form settings -> Quizzes and then "make this a quiz". Once I make it a quiz, I can manually assign…
5
votes
3 answers

How to find if sheet is empty?

I am getting the data range of a sheet and using Range.getNumRows() to get the number of rows in a Google Spreadsheet using Google Apps Script. But when the sheet happens to be completely empty, Range.getNumRows() still returns 1 instead of 0. I am…
5
votes
2 answers

How to make a Google Sheet custom function as an Add-On

I'm tying to create a custom function for google sheets that will be accessible with an Add-On to Google Sheets. The problem is when I run the Add-On as a test, when I type in my custom formula it gives me this error: #NAME? Error Unknown function:…
c.dimock
  • 59
  • 3
5
votes
2 answers

Custom google app script doesn't work after copying spreadsheet with google java client

I have google spreadsheet template with custom add-on which I'm trying to copy def copyTemplateSpreadsheet(Drive driveService) { File templateCopy = new File() templateCopy.setName("excel-template") def copiedFile =…