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

How to convert a Google Sheets-File to an Excel-File (XLSX)

The image shows the code who is updated. The var "xlsFile" is undefined, why? How can I convert the Google Sheets file to an Excel file with (Google Sheets) Script Editor function googleOAuth_ (name, scope) { var oAuthConfig =…
5
votes
2 answers

Run javascript as the form is being filled by users

I am new to Google Apps Script and need help. I am trying to achieve the following: Set a trigger for lost-focus of a textbox in Google Forms. The code in this event will be Get the value of a textbox Set the value of a textbox
Sasmit
  • 160
  • 1
  • 10
5
votes
1 answer

How can I move the cursor to the beginning of the document with Google Apps Script for Docs?

I am writing a script of Google Apps Script with my Google Document and wondering how to move the cursor to the very beginning of the document. What I was trying to do at the end is just replace the first line with some string.
Daisuki Honey
  • 157
  • 4
  • 12
5
votes
1 answer

Drive PDF revision ids are being ignored

This has come up before, related to the Google Drive SDK: How do I get exportLinks for revisions in Google Drive API. My problem isn't in getting the exportLinks - just that the ones provided by the API don't work. Here's a modified version of the…
Mogsdad
  • 44,709
  • 21
  • 151
  • 275
5
votes
2 answers

inject external javascript file in google app script(Google Docs)

Please let me know how to inject external javascript file in google app script(Google Docs). Thanks in advance.
5
votes
1 answer

Trigger an email when a cell is written into from another app (IFTTT)

So here's what I've been working on. I'm a basketball coach and have a spreadsheet that pulls in all of my players' tweets from IFTTT.com (it basically takes the RSS feed of a twitter list and when it is updated, it updates the spreadsheet). I have…
Tony Adragna
  • 77
  • 1
  • 8
5
votes
3 answers

How to automatically add a timestamp in google spreadsheet

I have a sheet in my Google spreadsheet that contains 5 cells, the first 3 contains only words while the last 2 contains time, specifically a timestamp. cell 1 = data cell 2 = data cell 3 = data cell 4 = time start cell 5 = time ended Now, what I…
Nixxhalle
  • 97
  • 3
  • 5
  • 10
5
votes
3 answers

Google Script sort 2D Array by any column

I had a asked an earlier question about retrieving records from a database, here: Retrieving Records from a Google Sheet with Google Script I'm fairly comfortable with manipulating arrays and creating my own sorting algorithms, but I want to use the…
nbkincaid
  • 107
  • 1
  • 1
  • 9
5
votes
2 answers

Is there a way to get the specific email address from a Gmail message object in Google app scripts?

In Google App Scripts to process a list of email messages in my inbox. From the messages I need to get the from and to addresses of each message. When I use the message.getFrom() method to get the from address it returns something like this:…
user3158212
  • 555
  • 6
  • 16
5
votes
1 answer

Creating PDF in Landscape (Google Apps Script)

I'm trying to work out how to create a PDF document through Google Apps Script which is displayed in landscape orientation (A4 size). This is the code I'm using to create the PDF so far, which comes out in portrait orientation. function pdfSheet()…
5
votes
2 answers

setFormulas won't skip empty array elements, over-writes values

Consider the code below: it sets values then sets functions across a range, however it overwrites the values that were set. function test() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var range = ss.getRange("A1:B2"); var values =…
AshClarke
  • 2,990
  • 5
  • 21
  • 27
5
votes
4 answers

Find LastRow of column C (when Col A and B have a different row size)?

How to find the last used cell of column C ? Example: "Sheet1" : "Col A" and "Col B" have 1200 rows. And "Col C" has only 1 row. ## ColA ColB ColC ## 1 1 1 ## 2 2 empty ## .. .. .. ## 1200 1200 empty Here are my…
miodf
  • 524
  • 3
  • 9
  • 21
5
votes
1 answer

Adding custom attributes to google doc text

I need to create a google apps script that will insert some string inside the active document. And I need to have the possibility later to know if the user has used the script on the doc and change the text that was already inserted. Is it possible…
Shadow
  • 51
  • 3
5
votes
1 answer

Tweet using Google Script

I pulled this code from this question. Applying the author's solution, I am always given this error: I get my key and secret from my created twitter app here: I have the app configured to write... What am I doing wrong? //post tweet function…
jth41
  • 3,808
  • 9
  • 59
  • 109
5
votes
1 answer

Check if a message has a label using Google Script

At work we have a google script code that is run every 4 hours and check everyone's @folders for unread mail. If unread mail is found it is moved to INBOX and tagged with @@UNREAD. What i need is a way for the script to check if it already has the…
Josh Fradley
  • 545
  • 1
  • 10
  • 23