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
20
votes
3 answers

Appending multiple rows to Spreadsheet - Google Apps Script

I wish to append multiple rows to a google sheet via GAS whilst being considerate of performance and undesired possiblities. To achieve this for a single row, I would use appendRow as this tackles problems with intervening mutations and completes…
dbr
  • 661
  • 1
  • 8
  • 21
20
votes
1 answer

What are some use cases for SpreadsheetApp.flush()?

What I understand is, .flush() helps to execute the functions as and when they happen without bundling them in one. Am I right? If not, what's the meaning in layman terms? And please, with a simple example.
Sowmay Jain
  • 375
  • 2
  • 4
  • 12
20
votes
5 answers

How can I pass a parameter to a time-based Google App Script trigger?

In my script, I am reading data from a Spreadsheet and creating a time based trigger to make a POST request with some of that data at a specific time. The problem is, I can't find any way to pass the data to the function that is called by the…
CodyBugstein
  • 21,984
  • 61
  • 207
  • 363
20
votes
4 answers

Google Sheets Pivot Table Not Updating

I have a google app script which submits info to an organized sheet and would like to create a pivot table with the all information in the sheet. I can do this, but whenever I submit a new row of data to the sheet, it is not automatically included…
Ben
  • 279
  • 1
  • 3
  • 8
20
votes
1 answer

How to get onFormSubmit to trigger automatically?

The "fix" (test_onformsubmit) code you gave, I have to manually run it every time there is new data in the spreadsheet. I was wanting it to automatically send the pdf to email when Form is submitted. Is there a way? Because the manual way runs the…
user2640294
  • 255
  • 2
  • 3
  • 6
20
votes
3 answers

Can I make Google Drive Spreadsheets act like a MySQL database?

Can I use a Google Drive spreadsheet as if it were (similar to) a MySQL database? I'm thinking of using it as a player database for an HTML/JavaScript web game. The player's username, password, and score among other things would be saved in the…
Jacob
  • 3,835
  • 8
  • 25
  • 25
20
votes
8 answers

function onOpen() is not running

My function includes adding a menu and toast to the document. I have verified that the trigger (onOpen) is set as well. It only works when a user goes into Tools, Script Manager, Run. We have too many users with too many backgrounds to expect then…
user1817058
  • 213
  • 1
  • 2
  • 7
20
votes
6 answers

Google Spreadsheet SCRIPT Check if edited cell is in a specific range

I need to detect if changes made to a spreadsheet are being made within a certain range of data and if so, set the current update time. The issue is, I have a spreadsheet that I edit headers and text on and I do not want the update time in a…
General Chad
  • 455
  • 1
  • 5
  • 17
20
votes
2 answers

Spreadsheet - Google App Script [string split function]

Just wanted to verify some thought regarding split function. I have constructed a simple code. var array1 = [{}]; var string1 = "A, B, C, D"; array1 = string1.split(","); The problem is based on this kind of coding for example in flash. The…
Nash
  • 203
  • 1
  • 2
  • 5
20
votes
5 answers

How to send a JSON payload with UrlFetchApp service?

I'm trying to POST to a web service that is expecting to get JSON as payload using Google Apps Script. I'm using the following code: var options = { "method" : "post", "contentType" : "application/json", "headers" : { "Authorization" :…
Guy
  • 12,388
  • 3
  • 45
  • 67
20
votes
2 answers

Cookie handling in Google Apps Script - How to send cookies in header?

I'm trying to write a simple script that fetches text from a webpage and processes that string. But, that website requires me to be logged in. I was successful in logging in to that website. This is how I logged in: var payload =…
akarthik10
  • 322
  • 1
  • 4
  • 11
20
votes
4 answers

Google Spreadsheet conditional formatting script

I am trying to figure out how to use conditional formatting on a google spreadsheet similar to what you can do in excel via a formula. I want cell A2 to change to Green if cell O2 has a value of "X" and this will be done on both columns all the way…
PY_
  • 1,189
  • 8
  • 18
  • 29
19
votes
4 answers

Google Apps Script logs (web app) don't show up in the new interface

Apps Script has recently moved the StackDriver logs into the Apps Script dashboard, page 'Execution'. Problem is, the logs won't show up in the dashboard for Apps Script web apps. I can see the new execution line when I do a request to the Apps…
lordofmax
  • 773
  • 1
  • 7
  • 21
19
votes
4 answers

Apply multiple font colors to the text in a single Google Sheets cell

I am trying to format a cell to have multiple font colors using a function in Google Apps Script. I am unable to find any documentation on it. Also, using getFontColor() doesn't return anything useful. Is there any way to programmatically reproduce…
MGomeyy
  • 215
  • 1
  • 2
  • 8
19
votes
2 answers

Unhandled exceptions in Google Apps Script

I have created a public Web App with access to my private spreadsheet data. I can catch and log exceptions intry..catch, but: is it possible to catch all unhandled exceptions, like browsers window.onerror? can I view logs of unhandled exceptions…
tenbits
  • 7,568
  • 5
  • 34
  • 53