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
24
votes
4 answers

onclick function runs automatically

Using google apps script I'm having trouble running a js function which passes parameters. When I add the parameters it will always run the code when the page loads instead of when the button is clicked. Direct from the HtmlService example, it is OK…
T-L
  • 291
  • 1
  • 3
  • 4
24
votes
7 answers

How to delete a File in Google Drive?

How do I write a Google Apps Script that deletes files? This finds files: var ExistingFiles = DocsList.find(fileName); But DocsList.deleteFile does not exist to delete a file. Is there a way to move those files to another Folder or to Trash? The…
user1962847
  • 241
  • 1
  • 2
  • 3
24
votes
3 answers

Set border color & style in spreadsheet programmatically

Google Spreadsheet has in the toolbar under the border button also a button to change the color and change the border style. How can these be accessed within a Google Apps Script? The setBorderColor function which is described for documents seems…
user1747567
  • 241
  • 1
  • 2
  • 3
24
votes
2 answers

\n not working in google apps script Browser.msgBox

I am trying the following to add line breaks to a message box but it is not working. function showMsgBox(){ var msg = 'name: \n \n \n Doc URL'; Browser.msgBox("Selected Doc template:", msg, Browser.Buttons.OK); } I does not matter single or…
Luciano
  • 365
  • 1
  • 2
  • 8
24
votes
7 answers

Execution order of GS files in a Project

Where can I read documentation concerning the execution order rules for GS files? To dimension the problem I created two trivial objects, each in their own file. 1_File.gs var ObjB = new Object(); ObjB.sayName = "[" + ObjA.sayName +…
Martin Bramwell
  • 2,003
  • 2
  • 19
  • 35
23
votes
1 answer

Google Spreadsheet adding tooltip

I need to add a tooltip (mouser over a cell) in a Google spreadsheet. I want the tooltip text to be taken from another cell, some idea? Thanks in advance!
sergio
  • 273
  • 1
  • 2
  • 6
23
votes
2 answers

How to parse JSON response in Google App Script?

I'm using a Google AdWords/App Script and I got this response from DoubleClick Search. I'm trying to parse it to put in a Sheet/ into an array to work with and I'm not having much luck. Thank you for taking a look. This is the original code: var…
Josh
  • 293
  • 1
  • 2
  • 8
23
votes
3 answers

How to add a link to a spreadsheet cell using Google Apps Script

It is possible to add a "link" to a cell in a google spreadsheet through the user interface. I want to do the same using a Google Apps Script. I was expecting there to be a method on the Range class for this but cannot see one. Does anyone know…
dmb_acunim
  • 377
  • 1
  • 2
  • 10
23
votes
8 answers

How can I find the Event Id of my Google Calendar event?

I created some Google Calendar events and now I would like to do some operations on them programmatically. Trouble is I don't have their IDs. When I go into the calendar and click on the event, there is nowhere where I can see the ID. Does anyone…
CodyBugstein
  • 21,984
  • 61
  • 207
  • 363
23
votes
13 answers

ALL Custom Functions return "unknown function" in one spreadsheet, but work in others

I have a few Simple Custom Functions that I use all the time. I have recently run into a spreadsheet that I desperately need to use them in, but when I try to use even the most basic custom functions, I get "#NAME?" with a hover text of "unknown…
Bob Wold
  • 371
  • 1
  • 3
  • 5
23
votes
5 answers

How to allow access for importrange function via apps script?

When you enter an importrange function manually into a spreadsheet you receive a pop up and must 'allow access'. However, I'm trying to find a way to do this via a script because I'm creating many spreadsheets, each with a query-importrange function…
23
votes
2 answers

google spreadsheet sidebar setWidth not working

Anybody else having trouble with the setWidth function? The example here is "300", but if you change the number, the sidebar is the same width. I've tried a few times on a clean…
jason
  • 3,811
  • 18
  • 92
  • 147
23
votes
5 answers

Count the cells with same color in google spreadsheet

I'm trying count the number of cells with the same background color and put the result in other cell with a script in google apps script, but I can't do it. I have the next script but not work and I don't know which is the problem: function…
user1974764
  • 241
  • 1
  • 3
  • 5
23
votes
5 answers

Call functions from another "class" / file

Ok, I feel embarrassed that I wasn't able to figure this out on my own, but after a few wasted hours, I figured it would be easier to simply ask over here: I have a bunch of .gs-files in my Google Apps Script project. Now, I want to call another…
TomTasche
  • 5,448
  • 7
  • 41
  • 67
22
votes
6 answers

Can you use Google Apps Script with Python?

Google Apps Script looks to be pretty perfect for a school project, however I'm not terribly comfortable with JavaScript and the entire rest of the project is going to be done in Python. Is there a way to access it using a Python library? Or do I…
Zelbinian
  • 3,221
  • 5
  • 20
  • 23