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
26
votes
2 answers

In Apps Script, How to include optional arguments in custom functions

I want to write a custom function which has some mandatory arguments but can also accept a few optional arguments. I couldn't find any documentation on this. Does anyone know? Is it similar to Javascript?
25
votes
2 answers

How to understand LockService and implement it correctly?

Summary of Code I have a Google Apps Script project that is used by around 80 users within a specific domain, however the app is executed by me (ie Publish > Deploy as web app > Execute the app as: Me). One of the functions of the script is to…
user1063287
  • 10,265
  • 25
  • 122
  • 218
25
votes
2 answers

How to write in cells in GoogleSpreadSheet using app Script?

and sorry for the stupid question. I know how to program on VBA for Excel, but I´m having a hard time doing the simplest stuff in Google Spreadsheet and I can´t find any good tutorials on-line. My question is regarding cells. In VBA to write in a…
user3347814
  • 1,138
  • 9
  • 28
  • 50
25
votes
5 answers

How to replace text in Google Spreadsheet using App Scripts?

I tried to get the value of a range and than remove all points from the cell. var FILE = SpreadsheetApp.openById("xyz"); var CONTENT = FILE.getSheetByName("Sheet1"); var A1 = CONTENT.getRange("I17").getValue(); A1. replace(".", ""); It gives me…
user2103505
  • 361
  • 1
  • 3
  • 6
25
votes
9 answers

How to Create a Spreadsheet in a particular folder via App Script

Can anybody help me out, I want to create a Spreadsheet through App Script in a particular folder. How to do that. Presently I am doing as follow: var folder = DocsList.getFolder("MyFolder"); var sheet = SpreadsheetApp.create("MySheet"); var file =…
Hari Das
  • 10,145
  • 7
  • 62
  • 59
25
votes
1 answer

Google Apps Script formatDate using user's time zone instead of GMT

In a function within Google Apps Script I am using Utilities.formatDate() let formattedTimestamp = Utilities.formatDate(new Date(), "GMT", "hh:mm a"); The resulting string is a timestamp in the GMT time zone but I need it to be in the current…
Employee
  • 2,231
  • 3
  • 33
  • 60
25
votes
3 answers

Linking to another HTML page in Google Apps Script

When linking from ScriptDbConsole.html to legend.html I get the following error message: Sorry, the file you have requested does not exist. Please check the address and try again. This would normally work in a normal environment, but not here I…
MOTIVECODEX
  • 2,624
  • 14
  • 43
  • 78
25
votes
9 answers

How to add "Edit Response" link to Google Forms emails?

I have a simple Google Form that collects data, and, using AppScript, sends confirmation emails to users who fill it out. After user submits the form, on confirmation, s/he will see a link to edit his/her response. I'd like to include that link as…
DashK
  • 2,640
  • 1
  • 22
  • 28
25
votes
3 answers

AJAX post to google spreadsheet

I am attempting to post form data to a google spreadsheet. Currently, if the form is validated, then the following occurs: if (validateForm === true) { $.ajax({ type: 'post', url:…
Stuart Nelson
  • 4,202
  • 2
  • 23
  • 26
24
votes
8 answers

Placing checkboxes in Google Sheets using Apps Script

I know that checkbox is a relatively new feature in Google Sheets, so I'm trying to find a way to automatically create checkboxes in cells. So far, I haven't found a reference regarding this in Google Apps Script documentation. Currently I'm doing…
Zyre Soriano
  • 575
  • 4
  • 13
  • 25
24
votes
2 answers

Google app script desktop ide

I like to use google sheets with app script, but the online script ide is a hassle(lags...etc) and does not have many of the conveniences of a desktop ide. Hopefully, Google will make a desktop ide at some point. Does anybody know of a less painful…
24
votes
10 answers

Deleting rows in google sheets using Google Apps Script

I encountered the weirdest error while trying to delete rows that match a specific value using Google Apps Script. Here is my Code: function myFunction() { var doc = SpreadsheetApp.getActiveSpreadsheet(); var sheet =…
Bharath Sankar
  • 438
  • 1
  • 4
  • 14
24
votes
3 answers

Increment Cell value by one by clicking

I want to write a formula in Google sheets so that I can attach to a button to make the value in a cell increase by 1 each time you click it. Here is the best I could find on this topic. I attempted to do this, but to no avail. I am using Windows 7…
zthomas.nc
  • 3,689
  • 8
  • 35
  • 49
24
votes
1 answer

How can I share my app script, between google spreadsheets?

I have a corporate google account (with a domain) and I've created a script to access a database, to share data between some spreadsheets to make simulations. I created some custom functions like =listAllCustomers() and now I want to use with any…
24
votes
6 answers

Search spreadsheet by column, return rows

I'm trying to find the best script in terms of runtime to complete a task. I've got a decently large spreadsheet where I need to check values in certain known columns, and depending on a match case it returns that row. Ideally I'd like a new…
Henry David
  • 441
  • 1
  • 5
  • 12