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

Google Spreadheets Scripts: check if cell is empty

I want to input a variable in a cell only if the cell is empty. The if statement, however, does not work. Any advice? var ss=SpreadsheetApp.getActiveSpreadsheet(); var r=ss.getRange("'odpovědi'!A2:J"); var rws=r.getNumRows(); ax=r.getCell(rws-1,…
orobinec
  • 445
  • 1
  • 4
  • 5
43
votes
15 answers

New Google Sheets custom functions sometimes display "Loading..." indefinitely

SPECIFIC FOR: "NEW" google sheets only. This is a known issue as highlighted by google in the new sheets. Issues: If you write complex* custom functions in google-apps-script for google sheets, you will occasionally run into cells which display a…
43
votes
6 answers

How to protect the Apps Script code in a Google spreadsheet?

I have written some code for my Google spreadsheet with the script editor. I want to share this spreadsheet with my clients but I don't want to share the code I have written. This code adds a menu to my spreadsheet which contains useful functions…
namit
  • 6,780
  • 4
  • 35
  • 41
42
votes
6 answers

How to generate an uuid in google sheet?

How to generate an uuid in google sheet (for exemple ccb8a660-91c9-a556-58e0-4fa7-229516872004). Either with a macro? or a formula?
42
votes
1 answer

Creating anchored comments programmatically in Google Docs

I have been unable to programmatically create a comment that is anchored to specific text in a Google Doc using an app script with the document. Google documentation about how to create an anchored comment using the Google Drive…
42
votes
13 answers

Is there a way to evaluate a formula that is stored in a cell?

In a Google Docs spreadsheet, I'm looking for something like =EVAL(A1) where A1 is set to "=1+2". I found out that in MS Excel there is an EVALUATE() function (which seems a bit tricky to use properly). But I could not find anything similar in…
42
votes
10 answers

Insert date time in google document

I would like to insert a timestamp (date and/or time) into Google Documents. The support documentation () says that there should be a keyboard shortcut, but it does not work in my environment (Win7 + IE9). Can anyone provide me with a Google Apps…
rbregt
  • 437
  • 1
  • 4
  • 3
40
votes
6 answers

Google Drive Page Not Found - Sorry, unable to open the file at this time

I'm using google scripts to deploy a web app. I've done about 5-10 in the same account. When I try and run the web app/script, I'm now getting: a "Google Drive: Page not found" in the title and the message Sorry, unable to open the file at this…
Douglas Russell
  • 513
  • 1
  • 4
  • 5
40
votes
4 answers

Get column values by column name not column index

I'm new to Google Apps Script. I want to get the value of a specific cell by it's column name, not the column index. Here is what I have: var rows = sheet.getDataRange(); var values = rows.getValues(); var row =values[1]; var rowStaffName =…
Kelli Roddy
  • 453
  • 1
  • 5
  • 8
40
votes
4 answers

How to automatically import data from uploaded CSV or XLS file into Google Sheets

I have a legacy database system (not web accessible) on a server which generates CSV or XLS reports to a Google Drive folder. Currently, I am manually opening those files in Drive web interface and converting them to Google Sheets. I would rather…
40
votes
7 answers

get value in one column in spreadsheet using google apps script

I want to get a string value to compare it later on with an if condition from only one column in a spreadsheet using Google apps script. I searched the internet and I found this link - sorry if this sounds stupid, but I am new to Google apps scripts…
Hashim Adel
  • 715
  • 3
  • 8
  • 14
40
votes
11 answers

Delete a row in Google Spreadsheets if value of cell in said row is 0 or blank

I'd like to be able to delete an entire row in a Google Spreadsheets if the value entered for say column "C" in that row is 0 or blank. Is there a simple script I could write to accomplish this? Thanks!
Zack
  • 399
  • 1
  • 3
  • 4
39
votes
5 answers

You do not have permission to call openById

Problem: When I run the script, Google tells me, You do not have permission to call openById I had copied a script from another one of my Google spreadsheets and changed the target_ssKey variable's cell reference and created properly-sized Named…
39
votes
2 answers

Which Edition of ECMA-262 Does Google Apps Script Support?

According to this thread from the old Google Group, Apps Script is based on ECMA-262 3rd Edition. This would seem to be supported by the fact that auto-completion in the editor displays 3rd Edition array functions. However the following code runs…
chrisbateskeegan
  • 1,013
  • 1
  • 11
  • 14
39
votes
1 answer

Stopping the error "Authorisation is required to perform that action" in Google Apps Script

I keep getting this error message when I try to view my deployed app. Authorisation is required to perform that action How do I get around the error? Services in use in the script: ScriptDB UiApp (I think that is all) I can't find the answer in…
Ryan Smith
  • 1,255
  • 2
  • 13
  • 16