Questions tagged [google-apps-script-addon]

1

votes
2

answer
10k

Views

Google Forms Complex Email Send on Form Submit with Script

I have this right now as a script to send an email to myself as a test showing that there is a new application submitted, but I am looking to have a full-fledged email sent to our HR department giving the name of every field following by a : and a space then what their answer was. I know you can do...
1

votes
0

answer
32

Views

sheets add-on giving 1-hr trigger error, even when there are no triggers installed

I wrote my first google app script with simple menu & sidebar; it works fine from script-editor but when I publish it as a 'sheets add-on' then 1. one of the textbox's in sidebar is missing 2. sidebar's submit/cancel buttons are not working Further more, on executing other menu items ... I keep on...
Deepak Kumar
1

votes
1

answer
41

Views

How can I store a copied google document element?

My code currently searches for a predefined start tag in google document, and locates a corresponding ending tag. The position of the tags is retained in a variable. Next the code runs through and copies all of the elements between the tags into a second google document. This works as expected. Ho...
Jason Allshorn
1

votes
0

answer
283

Views

Google Script HMAC SHA512 output differs when adding '\n'

I'm trying to create a google script that generates a HMAC signature using SHA512 for authentication to an API. Here is the code I'm using: var SystemTimeMilli = Date.now() var InputString = ('Some Text' + '\n' + SystemTimeMilli); var PrivateKey = 'bEDtDJnW0y/Ll4YZitxb+D5sTNnEpQKH67EJRCmQCqN9cvGiB8+...
JayDough
1

votes
0

answer
342

Views

I need to make multiple copies of google sheets, including sharing and permissions

I have weekly, hour by hour production logs for many different machines. I need to make 52 copies at a time, keeping permissions intact. I did find a way to make copies, but I lose the permissions on the protected ranges. This is how I made the copies- function copyDocs() { for(i=0; i
Michael Lake
1

votes
1

answer
124

Views

Google apps scripts set cell formulas needing row number for a row added via appendrow

I have a google sheet that is populated with activities via a google form. One of the fields is an activity date field. Once done, the activity is moved to another sheet for reporting purposes via appendrow. var cells = [activityDate, title, completionDate, ...]; destsheet.appendRow (cells); To ai...
BrianScheffer
1

votes
1

answer
164

Views

passing multiple arguments to addCallBackElement Google Script

Is there any way to add multiple arguments to an addCallBackElement() function in Google Scripts? I want to send information about what the user typed into a given text box, as well as an integer. Can I send both of these? If not, is there any way I can see what the user typed into a textbox without...
Ethan Goldberg
0

votes
1

answer
5

Views

How to copy last row from google sheet and copy to last row of other google sheet

I've tried every example and have been working on this for days, appreciate any help. I just want to copy the last row from one sheet and copy it to the last row of another sheet. This last example copies all the rows, not just the last row. I have tried every sample and example I could find without...
Burt Lewis
1

votes
1

answer
41

Views

how to prevent manual changes (that are not written by the script) on a sheet?

I have a Google sheet where I need data to be entered on it only by script and I need to protect it from manual adjustment by protecting the rows already filled by script, the case is we are a team and a script logs all the changes every team member does in a row on a separate sheet (ChangeLog). Th...
Mostafa Abusamra
1

votes
2

answer
96

Views

Get value of object field using variables to build the field name

I am using a free currency converter API as shown in the code: // Free Currency Converter url = 'https://free.currencyconverterapi.com/api/v5/convert?q=EUR_USD&compact=ultra'; response = UrlFetchApp.fetch(url); rateEURUSD_FCC_JSON = JSON.parse(response.getContentText()); rateEURUSD_FCC = rateEURPLN_...
Rafal2017
1

votes
1

answer
348

Views

Using HtmlService.createHtmlOutputFromFile vs HtmlService.createTemplateFromFile

I have a problem with my Google Apps Script. I need a responsive design app with the right title in the tab (usually declared by the tag). Using HtmlService.createHtmlOutputFromFile makes it possible to add the meta tag which makes responsive design possible: var template = HtmlService.createHtmlOu...
Sep Keuchenius
1

votes
1

answer
46

Views

How to make for loop script more efficient?

I'm very new to script writing in general, especially in GAS, and want to make sure I learn good habits. I wrote a for loop script that, in essence, does the following: Read through column A starting at row 2 If cell above current cell in for loop is the same value, then clear the contents of the ad...
Bcos
1

votes
0

answer
245

Views

no permissionas for setting Authorized JavaScript origins in google app script

i want to set my uri inside Authorized JavaScript origins but it gaves me You do not have permission to perform this action. Tracking Number: c527557048 the steps of the block of Enable APIs and credentials. Access the automatically created apps script Developer Console Project by go to your new pr...
Dodji
1

votes
1

answer
49

Views

Performance issue: 1 simple script tested on 2 spreadsheets, execution time differs (from less than 1s to 7s)

I tested a simple script on 2 different spreadsheets and the execution took less than 1 sec for the first spreadsheet and about 7 sec for the second spreadsheet (even though it's the same code). Here is the code, very basic (just retreiving a value in a sheet), used on the 2 spreadsheets: function t...
Julien
1

votes
1

answer
170

Views

How to automatically authenticate Google Drive through Docusign API

I am creating an app with Google apps script to send Docusign envelopes to customers when I receive a google form from them (with the responses going into a google sheet with an onFormSubmit trigger). I'm using the Docusign REST API envelopes method to create an envelope, and send directly to the cu...
Alex James
1

votes
2

answer
381

Views

Google Sheets Custom Function API: Return Sunrise/sunset + GMT/DST Offset based on lat/long

I'd like to have the function return the sunrise or sunset formatted with the appropriate GMT offset based on the coordinates. I found a different API that lets you get sunrise/set times for a given date and location as well as providing GMT or DST offset. function SunRiseSet(lat,long,date,type) { v...
Jeremy Bauman
1

votes
1

answer
75

Views

Server status for Google Apps Script

Hellos, I was wondering if anyone knew how to monitor server status for Google Apps Script? It seems to have gone down today, and none of my apps worked for over an hour... Looking at Google's server status page doesn't indicate any problems with Google Sheets, but this isn't the sheet itself, but r...
Laserheart
1

votes
0

answer
255

Views

Session.getActiveUser().getEmail() returns no Value

this is my first Stackoverflow Questions, so I'm trying to do my best to be clear and structured here but please forgive me for beginner mistakes :) So I'm having a little issue with the Script Editor of Google, basically I'm calling the Session.getActiveUser().getEmail() as well as the Session.getE...
Bruce McGivern
1

votes
0

answer
174

Views

Google Script XML Parsing Error: Cannot find function

I uploaded a number of XML files to my Google Drive. They are set to be shared with anyone on the web. I made a list of the links in a Google Sheet. (Picture below.) I am trying to parse the XML files using a Script from GitHub. (See below for full script.) However when I call the function in cell F...
Ike
1

votes
0

answer
101

Views

Google Apps Script, import ics files

How can I import ics files by using google apps script? In my case i would like to import multiple ics files, from Gdrive or from local pc. Thanks in advance.
RHO
1

votes
0

answer
313

Views

“Limit Exceeded: Email body size” when putting a URL in the body

Whenever I include the URL in the body, I get Limit Exceeded: Email Body Size. Is there anyway to get around this? function CustomEmail() { var ss = SpreadsheetApp.openById('1zajVyOx6y_26yjDmEOFtAZVHc_Mr5UNg1EP8YBjGj0s'); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Follow Up L...
Kyle Richardson
1

votes
0

answer
37

Views

Google Apps Script published add-on stopped working post chnages

I have a published Add-on in web store for Google Docs. I have also been able to make changes to it and re-publish to web store couple of times in past. But when I made a recent change to add-on, it won't allow me to test as Add-on again. Only error I am getting is: 'There was a problem testing the...
pdholakia
1

votes
0

answer
68

Views

Is there a way to specify trusted origins for post requests in google web app?

Let's say i created a google sheet to capture user's email addresses. On my website there is a small form and once the submit button is clicked and an ajax request to a google web app that writes data to a sheet is fired: // Let's select and cache all the fields var $inputs = $form.find('input, sel...
Felix
1

votes
0

answer
37

Views

Does every get<Something> request on a CalendarApp object correspond to one HTTP request/API call?

Using Apps Script and Google's CalendarApp, I'm trying to get all the events from two calendars for two days (today + tomorrow) and sort them by start time. I'm currently doing this like this: // Function passed to sort() later to compare two calendar events function compareEvents(event1, event2) {...
Aneev Davis
1

votes
1

answer
271

Views

force empty cells to end of sorted column

I want to sort a sheet by a column that has strings in it. I'm populating the sheet by putting a query based on an import range in the first cell. It seemed best if I did the sort as part of the query, order by Col6. This places all the empty rows at the top unless I sort descending, which I do n...
Brandon Smith
1

votes
0

answer
75

Views

I have an issue deleting events on the Google Calendar of a Web Site

I'm working on an Intranet Web Site. One of the tasks in this site is to schedule events on a Google Calendar for booking a room at the company. The scheduler is working fine, but the big issue comes when the user tries to delete the event. The actions should be like this: Click on the 'url for dele...
Zita Noriega Estrada
1

votes
0

answer
38

Views

How do I list a specific user's permissions on a teamdrive using Google Apps Script?

Per the Google API reference it looks like a Drive.Permissions.List call would work on a Teamdrive, however I am getting a 404 error when using the following: Drive.Permissions.list(TEAMDRIVEID); Is there an alternative way to get a specific user's permissions to a specific drive?
Bryan Bartley
1

votes
1

answer
387

Views

How to make a Drive API batch request with UrlFetchApp in Google Apps Script

I would like to know how to make a Drive API batch request with UrlFetchApp in Google Apps Script. I've read the google documentation but it still isn't clear to me. I want to convert the code below into a batch request accepting multiple file IDs. var url = 'https://www.googleapis.com/drive/v2/fi...
f k
1

votes
2

answer
909

Views

Google spreadsheet script very slow

I've got a script that i run each day. it's incredibly slow and i can't figure out what's slowing it down. Anyone have any suggestions? I originally wrote a function to do one sheet, then i added a function to loop and call it on every sheet. function addAllLog() { var ss = SpreadsheetAp...
Cactus Dude
1

votes
1

answer
1.7k

Views

Determine correct date format of Google Form response

What is the best way to determine the correct date format (dd/mm or mm/dd) of a Google Form response. When I use the namedValues object: function onFormSubmit(e){ var namedValues = e.namedValues; var date = namedValues['Date']; // Date=[05/06/2018] var date = new Date(date); Logger.log(date); //Sun...
beano
1

votes
0

answer
79

Views

Posting data from HTML form to Google Sheet

Hi, I want to submit this form to a Google sheet : First: Last: The Google Script is : function doPost(e) { // Sheet var ss = SpreadsheetApp.openById('id_of_the_sheet'); var sheet = ss.getSheetByName('Sheet1'); // Timestamp var timeZone = ss.getSpreadsheetTimeZone(); var timestamp = Utilities.format...
Guillaume Nicoulaud
1

votes
1

answer
45

Views

Split text with separator appending a row

I have a question for Google Script on how to split text with a separator at the same time i append a row with data. Where 'content' has body text with the separator. Here is my script: function readMail() { var thread = GmailApp.getInboxThreads(0, 1)[0]; var messages = thread.getMessages()[0]; var...
T O
1

votes
1

answer
42

Views

Adding a formula to a cell with a function gives error

I need to add a formula to a cell with a function, I want to add =unpivot(copyColumns('Elements!A,B,C,D,E',1),2,1,'New','New2') but there are quotes in the formula and I keep getting errors because of them. I am trying \ which from searching is suppose to work Thanks function iSetFormula_n(){ iSetFo...
xyz
1

votes
0

answer
36

Views

Convert underlined text to highlighted text in Google Docs

I'd like to write a script to highlight any word in a google doc that is underlined. This is the closest thing I could find. (Note - in the last line milk would be yellow, not grey.) Example I went to the store and bought m̲i̲l̲k̲ and eggs. would change to this: I went to the store and bought...
moonshot
1

votes
1

answer
43

Views

How to copy active text from google docs to spreadsheet with menu item/option

I'm fairly new to google apps and I know that similar questions have been asked but they only adress similar problems. I hope you can help me. I want to copy an active text from a google docs to a given spreadsheet via a button. I've done similar for spreadsheet to spreadsheet but I'm failing on do...
JoeL31
1

votes
0

answer
234

Views

Change color of text inputs in Gmail Add-on

I am using Google Apps Script for Gmail Add-on. Changing 'secondaryColor' in manifest file for gmail add-on does not change the color of form inputs(TextInput). It is written in the documentation that it will change the color of both buttons and form elements but it does not seem working for for...
Biren Prajapati
1

votes
0

answer
34

Views

Viewing individual form response shows different id to one given by script

I'm trying to determine how the URLs are structured and I can't work it out. In the url I know that the first ID is that of the form itself but I cannot work out what the second ID is. The code I run gets the most recent response and its ID FormApp.openByUrl(source_sheet.getFormUrl()).getResponses(...
James Gabauer
1

votes
2

answer
857

Views

How do I center a table in a google document page using Google Apps Script

I have inserted a table in a google docs using the Google Apps Script function var grg = body.appendTable(griglia); I am able to format the text in the table (font size, weight, alignment) and I can format individual cells (background, foreground, borders). However the table is aligned left, and I w...
PFB
1

votes
0

answer
101

Views

Integrate google forms with custom content

I am pretty much new to Google forms. I want to create a google form that will be a survey primarily. For each question I have to show a 3d model (threejs?) and a rating will be given on the model. So the primary content for each question is a 3d model and a text line related to the content. The use...
1

votes
0

answer
56

Views

Copy/Paste and merging data between two sheets with a button and JavaScript

Currently I'm trying to setup a rental tracking spreadsheet in google sheets, for a DJ tech store. I would need some help with scripting a code for the 'Add' button (see pictures in the links). Sheet 1 Sheet 2 The functions might be quite simple to conceive, yet a bit tricky to code, therefore I'm h...
Imants Koķis

View additional questions