Questions tagged [google-apps-script]

Use for questions about Google Apps Script, Google's server side Javascript V8-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
18,788 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
14 votes
2 answers
4k views

Exporting Google Sheet as PDF with Custom Headers or Footers in Google Apps Script

I'm wondering how to add custom headers or footers to a PDF that is exported using Google Apps Script from a Google Sheet. I would like to add a footer that says "My Company Proprietary and ...
Colin Fennern's user avatar
10 votes
3 answers
3k views

Retrieving the link to a response from a Google Form

I have a script attached to a Google Form which sends a notification to a Discord channel on submission. I want to include a direct link to the individual response (link looks like https://docs.google....
sascha_lamp's user avatar
10 votes
4 answers
3k views

Google Apps Script JDBC ResultSet to Array

Is there a better way of retrieving the results from a ResultSet? Calling getString() on each value is very slow. It takes up to 2.5 seconds to put about 400 rows, 16 columns into an array before I ...
Jack's user avatar
  • 5,720
10 votes
2 answers
9k views

WordPress Api error: "Sorry, you are not allowed to create new posts."

I'm using the current Apps script function to add a new post to my WordPress site: var um_url = 'http://test.mywebsite.com/wp/wp-json/wp/v2/posts'; var um_headers = { "Accept" : "application/...
mdkass's user avatar
  • 111
9 votes
2 answers
1k views

Apps Script: force blur on editing cell to save its content

This is my scenario: 1 cell: A1 where you can input some text 1 image / drawing: when it is clicked a script function is called The problem is that the script attempts to read A1 content, but if ...
Alvaro Prieto's user avatar
9 votes
0 answers
10k views

Sending file attachments along with Google Docs form submission, having them emailed?

I'm building a form using GDocs, and then taking the form out into my web page so I can directly edit the form (so I do have complete control over the form code). Right now I'm able to submit the ...
David K's user avatar
  • 138
8 votes
0 answers
955 views

Dimension and metrics not appearing properly in data studio community connector

Within the getSchema function in my Google Data Studio community connector, I am building up my list of fields and declaring/setting dimensions and metrics accordingly. ex: fields.newMetric().setId(...
CB Hoffman's user avatar
8 votes
1 answer
9k views

Access Google Apps Script editor from Android

I am searching for the answer for a couple of months now. Any browser redirects to downloading the Google Sheets app, which doesn't have the script editor. Stack Overflow redirects to a question ...
Fim's user avatar
  • 153
8 votes
0 answers
1k views

Add custom star to Gmail Message using Gmail REST API or Google Apps Script

How can you use the Gmail REST or Apps API to add a custom star to a message? Is there an alternate label name we can use for the Gmail REST API? Is it even possible from the Google Apps Script API? ...
Sean's user avatar
  • 1,269
8 votes
0 answers
1k views

How to set revision history with Google Apps Script

Trying to figure out something with the Advanced Google Apps Services and Google Apps Scripts. I want to essentially alter documents to revert them back to a prior revision but doing it ...
Odin's user avatar
  • 93
8 votes
3 answers
3k views

How to use labels in Gmail to identify single messages instead of threads that have already been processed by a script

Using google script for google mail, I'm trying to upload new emails with certain labels to our CRM using an API. I can't check if messages have been uploaded already, so I have to apply a label in ...
John Willson's user avatar
7 votes
0 answers
802 views

Bandwidth Quota for Google Apps Script

This morning we got a couple of errors from Google Apps script saying: Exception: Bandwidth quota exceeded... Try reducing the rate of data transfer. Our Google Apps Script (GAS) programs mainly look ...
Chris's user avatar
  • 483
7 votes
0 answers
4k views

'Gmail Operation not allowed' exception after multiple calls to Gmail operations; how to avoid?

I have a script that basically searches a folder for emails received before a certain date (uses a GmailApp call for the search multiple times in one iteration) and then moves those messages to the ...
okchaud's user avatar
  • 71
7 votes
0 answers
338 views

Gmail addon - how do I find the current draft ID

I'm building a gmail addon which lets users insert a template into the compose window. It works fine but I'd like to get the ID of the draft they're editing and I can't figure out how. It's not ...
Caedmon's user avatar
  • 687
7 votes
0 answers
434 views

UrlFetchApp.Fetch non standard port

Hope someone can help. I need to return some data from a RESTful API service that is hosted on a non standard port 9091. I am using the following as a test harness: var options = { 'method' : '...
Mark Donnachie's user avatar
7 votes
0 answers
9k views

Google data studio connector: "Sorry, we encountered an error and were unable to complete your request."

I'm not sure where to look to get information on what error Google Data Studio is encountering when running a custom Google App Script connector. I created a script, published as a manifest with a ...
Bart Silverstrim's user avatar
7 votes
0 answers
1k views

Export a specific page of a Google Doc to PDF via Google Apps Script

The original code basically converts the Google Doc to PDF based on 2 different templates (2 different Google Doc with 2 different keys); From the Google Form responses, if a standard part is ...
Danial Asraf Norbee's user avatar
7 votes
2 answers
3k views

Permissions error when running a script in a Google spreadsheet

We are developing a program that uses Google spreadsheets as the input. The values of the spreadsheet is read, processed and a result is showed in a webpage. When an user sign up we clone a ...
razonasistemas's user avatar
7 votes
0 answers
2k views

Apps Script save as pdf doesn't include drawings and images

I want to save a Google Doc file as a pdf in the same Google Drive folder as my current file. I know I can download the file as a pdf, but then I have to upload it into the same Google Drive folder. I ...
davids's user avatar
  • 5,497
7 votes
0 answers
581 views

Bound script breaking when file it's bound to is copied

I have two bound scripts in a template I am replicating hundreds of times. The scripts are easy and small. They work fine in the initial template, but when I copy the file dozens/hundreds of times, it ...
Fowzee's user avatar
  • 91
7 votes
0 answers
5k views

How to upload any file to FTP Server using Google Apps Script

I have attachments in my Gmail mail threads and i have written code to get attachments from mail and i am trying to upload it on a FTP location using Google script but it seems there is no suitable ...
mukul's user avatar
  • 433
7 votes
1 answer
2k views

Uploading Image from google drive to amazon S3 using app script

I am integrating google form to our backend system. In the form, we are accepting images on google drive. I am trying to move google drive images to s3 whenever a form is submitted. I am using this to ...
Gopal Kumar's user avatar
6 votes
0 answers
810 views

Exception: Unexpected error while getting the method or property getContentUrl on object SpreadsheetApp.CellImage

I'm trying to extract an in-cell-image from google sheets to later paste to a google docs. Using this method I'm getting an error and couldn't find any documentation about this. function onClick(){ ...
Amit Nelinger's user avatar
6 votes
0 answers
8k views

Is there a way to interact with google finance data in google app script?

I'm trying to calculate the rate of change in Google finances' data. For example if price of AMD was 2 dollar and tomorrow it was 1 dollars, then the result I want is -0.5. I called the Google finance ...
jjunbbug's user avatar
  • 127
6 votes
0 answers
4k views

Login into a website using google apps script and click through to scrape data

I want to login to a website and navigate to a specific page to scrape the data. I am planning on using scraping (not API at the moment) and for learning purpose I plan on doing it on my stackoverflow ...
everestial's user avatar
  • 7,005
6 votes
2 answers
1k views

getRowHeight() returns default row height instead of actual height, when text wrap is enabled

I want to be able to format and adjust the size of the rows programmatically when creating a report in Google Sheets so that I don't have the header stuck on one page and then content on the next with ...
Trevor's user avatar
  • 117
6 votes
0 answers
570 views

GMail Snooze with Google Apps Script

As of July 2018 GMail supports a native snooze function (https://gsuiteupdates.googleblog.com/2018/07/new-gmail-ga.html). Snooze, referring to "don't show me that message until a certain day". ...
dreamflasher's user avatar
  • 1,455
6 votes
2 answers
6k views

JSON post request to slack returns invalid_auth

I'm trying to open a dialog in slack through a google app script after the user presses a button but i'm getting the following error message: {"ok":false,"error":"invalid_auth","warning":"...
Mário Guidoux's user avatar
6 votes
1 answer
4k views

Changing data validation source values does not update cells using the original value

I have Sheet1 with an in-cell dropdown select box. The values in the drop-down come from the values in a different range (i.e. on Sheet2) What I need now is to update the value in any cells with data ...
user avatar
6 votes
0 answers
658 views

Security in google apps script public HTMLService with new Utilities.getUuid() for each request

First question in stackoverflow in my life! I am coming from the embedded programing world, and I have a very superficial knowledge on web security. I have build a platform using google apps script. ...
twelvepointone's user avatar
6 votes
0 answers
1k views

How to handle timeout error if user nevers click on alert?

I have a Google Sheets Add-on which uses the dialog boxes provided by the App Script Ui service, i.e., SpreadSheetApp.getUi().alert(...). This normally works fine unless a user does not select an ...
user1754115's user avatar
6 votes
1 answer
280 views

Only one type of action can execute?

I going to show my problem with an example: I have a button. When clicked, it creates a mail draft based on the TextInputFields in the add-on. I have a validate function, which can say if the fields ...
Ágoston Dauner's user avatar
6 votes
0 answers
20k views

Modify a Google Slides presentation while presenting?

I'm afraid I already know the answer, but maybe someone else has found a way to do this. I've been perusing the Slide Apps Script reference, and I'm excited about the possibilities. One thing I would ...
cmdr_keen's user avatar
  • 179
6 votes
0 answers
2k views

Is the GmailApp API send limit the same as MailApp?

I have a free tool for teachers that sends emails to each student in the class about the impact of an upcoming homework assignment on their grade (a 'grade nudge', so each email is custom to the ...
tazz_ben's user avatar
  • 279
6 votes
1 answer
600 views

How do I get scripts running again if the AppsScript service has been throttled?

I added this bound script to a google sheet trying to save time by not having to manually enter the sheetname in a cell: function sheetname() { return SpreadsheetApp.getActive().getName(); } ...
johlund's user avatar
  • 137
6 votes
0 answers
3k views

File exceeds the maximum file size, google apps + google drive

I'm trying to use Google Scripts for uploading user's files to my Google Drive. I deployed my google scipt as web app. I have two files: form.html <div id="output"></div> <form ...
sashadereh's user avatar
6 votes
0 answers
3k views

Google Apps Script prototypes and inheritance

I'm trying to understand how to use javascript prototypes and inheritance in Google Apps Script but apparently I'm still missing something. Here is the structure I'm working on. function Father (...
marcomk's user avatar
  • 147
6 votes
0 answers
5k views

Displaying/Converting PDF Documents and Google Apps Script

I have been trying to learn google apps script in an attempt to reduce my reliance on excel due to macros. I have been trying to learn it by creating something. I have half created a double entry ...
user3097534's user avatar
6 votes
0 answers
1k views

Google Apps Script suddenly started throwing 'invalid mime type' errors

I have a script which processes a shared mailbox and forwards on different email (based on things like the original 'To:' header to various people. It's been working fine for months as a more flexible ...
dsl101's user avatar
  • 1,754
6 votes
1 answer
671 views

How do I get exportLinks for revisions in Google Drive API

I am using Google Apps Scripts to attempt to get a list of exportLinks for the various revisions of a Google Drawing. The code below reproduces the problem. To try it out, call getRevisionHx with the ...
TorgoGuy's user avatar
  • 1,326
6 votes
1 answer
914 views

Catching onSelectionChange in the frontend side for a Google Sheets add-on

In Google Sheets, I have an add-on that consists of two parts backend code.gs and frontend index.html, where the index.html is a sidebar shown upon a click in the menu. Here is code.gs: function ...
Rami ZK's user avatar
  • 530
6 votes
1 answer
3k views

How to avoid DEADLINE_EXCEEDED when "We're sorry, a server error occurred. Please wait a bit and try again." happens?

I have read similar questions such as Error type of "We're sorry, a server error occurred. Please wait a bit and try again. " and many others, but they were specific to other types of ...
Basj's user avatar
  • 44.1k
6 votes
1 answer
3k views

Google sheets button with "assigned script" disappears

I have a spreadsheet with several scripts attached to images as buttons being used by lots of people. The weird thing is, there's a set of three buttons in each workbook, and one of them (the same one ...
Sean's user avatar
  • 73
5 votes
0 answers
373 views

Google Workspace add-on in Apps Script External/Testing status -- how test users can add it?

I am puzzled about what is the right way to arrange testing collaboration of the Workspace add-on, as there seem to be two different places to share the test access (none of which works for me quite ...
Lost Padawan's user avatar
5 votes
0 answers
123 views

How to get Google Editor Add-on menus and custom formulas in Google Sheets from a Google Workspace Add-on

This accepted answer says that it's not possible to get custom Google Sheets functions into Google Sheets from a Google Workspace Add-on. However, I came across a counterexample that proves the above ...
Let Me Tink About It's user avatar
5 votes
0 answers
418 views

GmailThread.getlables() fails randomly with the exception "Exception: Gmail operation not allowed."

This might be a weird one but I have some code that goes through my email and uses labels to trigger certain tasks. For example, if someone applies via Indeed, Indeed sends me an email. A filter will ...
Michael's user avatar
  • 51
5 votes
0 answers
397 views

Multi Selection Dropdown using CardService

I am working on Drive Add-on, and got stuck at implementing Multi Selection Dropdown using Card Services in Google App Script. Tried to implement the text box input with Suggestion parameters but ...
abhishekpramanik's user avatar

1
2 3 4 5
376