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
21
votes
9 answers

Cross-domain requests stopped working due to no `Access-Control-Allow-Origin` header present in the response

I have an error reporting beacon I created using Google Apps script and it is published to run as myself and to be accessible to "anyone, even anonymous," which should mean that X-domain requests to GAS are allowed. However, my browsers are now…
Joshua Dannemann
  • 2,003
  • 1
  • 14
  • 34
21
votes
2 answers

Google Script: MailApp.sendEmail to multiple addresses?

I have a script that is using the following script: MailApp.sendEmail(row.shiftManager, "Holiday Approval Request", "", {htmlBody: message}); row.state = STATE_PENDING; Howeverm I would like to also send the same mail to row.shiftSupervisor, this…
SL8t7
  • 617
  • 2
  • 9
  • 27
21
votes
1 answer

Is it possible to modify the Google Docs/Sheets right-click context menu?

It's well known on how to make a custom upper menu item (https://developers.google.com/apps-script/guides/menus), but can you append a function to the context menu when right clicking a cell or item?
user3645994
  • 409
  • 6
  • 13
21
votes
8 answers

Plain Javascript Equivalent of jQuery.param()

jQuery.param() takes an array of key-value pairs, and turns it into a string you can use as a query string in HTML requests. For example, a = { userid:1, gender:male } would get converted to userid=1&gender=male I'm trying to…
Neil
  • 3,100
  • 5
  • 29
  • 36
21
votes
3 answers

How to upload multiple files using one file input element

I'm trying to use one file input element to upload multiple files to Drive using html form. This seems to work only for one file, although the file picker allows selecting multiple files. Back in the script log viewer, I only see one file captured…
jad
  • 552
  • 2
  • 9
  • 19
21
votes
8 answers

Get Google Document as HTML

I had a wild idea that I could build a website blog for an unsophisticated user friend using Google Drive Documents to back it. I was able to create a contentService that compiles a list of documents. However, I can't see a way to convert the…
Ray Wadkins
  • 876
  • 1
  • 7
  • 16
21
votes
1 answer

getRange with named range google spreadsheet using scripts

Can the getRange be used to have a named range instead of an area? When I seem to do it, it says the argument must be a range. For example, Instead of: getRange("A4:E7"); The area of A4:E7 has been made into a named range called 'Names' in…
user1658604
  • 213
  • 1
  • 2
  • 6
21
votes
2 answers

Google apps script urlfetch encoding URL

I would like to use urlfetch to populate a spreadsheet with page data but the URL that I am trying to use is coming back with an error as an invalid argument. I think the problem is that I am using characters in the URL that are being misinterpreted…
Pigcowpig
  • 211
  • 1
  • 2
  • 4
21
votes
3 answers

Organizing Spreadsheet Code in several *.gs files - even possible?

I am trying to organize my code for a Spreadsheet in several script files. Within the script editor I can create as many *.gs files as I want, but I can't figure out how to access code that would be defined in another script. Simple Example of what…
leostone
  • 415
  • 1
  • 5
  • 9
21
votes
5 answers

Use project Javascript and CSS files in a Google Apps Script web app?

If I create a simple HTML web app in Google Apps Script, like this: function doGet() { return HtmlService.createHtmlOutputFromFile("index.html"); } and index.html looks like this:
Alf Eaton
  • 5,226
  • 4
  • 45
  • 50
21
votes
6 answers

Is it possible to have one script for multiple spreadsheets?

I have one master spreadsheet and a number of copies. This master spreadsheet uses some scripting. Is it possible to link all the copies of this master spreadsheet to the same script as in the master spreadsheet? Objective: changes in the…
Stefan van Aalst
  • 788
  • 1
  • 7
  • 19
20
votes
2 answers

OAuth consent screen - ability to remove application logo: old solution is no longer working

Question: how to remove an application logo. Solution: previous solution from this answer, https://stackoverflow.com/a/57168008/1992004, is no longer working. Google changed the format of "iconUrl" to "icon", and uses now the Base64-encoded data…
20
votes
4 answers

Apps Script: how to get hyperlink from a cell where there is no formula

I have a sheet where hyperlink is set in cell, but not through formula. When clicked on the cell, in "fx" bar it only shows the value. I searched on web but everywhere, the info is to extract hyperlink by using getFormula(). But in my case there is…
20
votes
6 answers

Using an imported module inside Google App Script

I am trying to use string similarity inside Google App Script, however it is not entirely clear to me how to get it working inside App Script, I get multiple errors, such as "require" is not defined, as another note, the module itself appears to…
Alejandro Jurado
  • 137
  • 1
  • 3
  • 15
20
votes
6 answers

How to copy a row from one google spreadsheet to another google spreadsheet using google apps script?

I wanted to copy a particular row from one spreadsheet to another spreadsheet using google apps script. Can anyone please help me to get the answer for this.
Ani
  • 249
  • 1
  • 4
  • 13