Questions tagged [google-apps-script]

Use for questions about Google Apps Script, Google's JavaScript-based cloud scripting language for automating tasks across Google products and third party services.

0
votes
1answer
20 views

How to sort range using Apps script based on a column

I have this demo sheet https://docs.google.com/spreadsheets/d/1pGkTrudeDfv7Xkm7ZGM0fmQzSCqU05hFVhuczJ4cWCQ/edit?usp=sharing im using this code to sort my data, function SortColumns(){ var ss = ...
-1
votes
0answers
18 views

how to print google sheets range with apps script

I have a google sheet, that I need to print or get a nice screenshot from a range of cells, is there a way to perform this with GAS ? I know its impossible to call a print from google sheets, but if ...
1
vote
1answer
22 views

Override Google Forms Naming Format

Google Forms file upload feature renames an uploaded file in the following format: (Original file name - Name of Uploader). I need to remove the name of the uploader. I have tried the code in this ...
0
votes
0answers
25 views

clearing contents of specific cells with specific words only

I'm looking for a google sheets script to clear contents of specific cells on different sheets. But if there are specific words in the cell it won't clear it. For Example on sheet 1 cell A2 if there ...
0
votes
0answers
28 views

Populate data validation via GAS

I have a script that populates data validations on one tab (Estimate) by populating rows in another tab (itemDataValidations) that I use as the range or helper. What I'd like to do is skip this ...
0
votes
0answers
19 views

linking google sheet to google doc via apps script

Is there a way to insert & link a table from google sheet into a google doc with apps script? The only way I've found to link a sheet to a doc is using copy & paste ... I'd like to automate it ...
0
votes
1answer
17 views

Manually run functions from a standalone script (GAS)

I have a code for spreadsheet tasks in a standalone script (for security reasons). But I also need to have a button or a menu item or something to be able to run the script manually just in case. ...
0
votes
2answers
27 views

How do I make text in a cell bold based on its cell fill color?

What formula (if any) I would use if I wanted to make text with a specific fill color to become bold? For example, if a cell's fill is gray and I want the text inside of every gray cell to be bold. I ...
1
vote
1answer
29 views

Google Drive : Delete FOLDERS older than 1 day

I’m searching some help with AppScript. I want to delete any FOLDERS which are older than 1 day. Here’s my situation I got a main folder that contains folders that contains files > Main Folder &...
0
votes
1answer
24 views

List and copy a specific named version of a Google Sheets file

Right now I am using this code to create a copy of a specific Spreadsheet. var fileToCopyID = "..."; var destinationFolderID = "..."; // get the root folder var destinationFolder = DriveApp....
0
votes
1answer
43 views

Element input type= text cannot input Vietnamese

I'm using individual column searching (text inputs) of datatables. There was an error that could not enter the search in Vietnamese but in input text "Search:" can input Vietnamese ! You can access ...
1
vote
1answer
42 views

How to use an element of an array as the argument of indexof?

I have two arrays of values. I want to use the elements of one array be the argument of an indexof function. But I get a -1 (meaning value not found) even when I know the value exists in the array. I ...
0
votes
1answer
27 views

How to return all task with google script

I have some codes to return the tasks in one of my tasklist. Problem is that it is only returning only 19 task at a time. It that normal if so how to I work around it Code is use are var tasks=...
0
votes
1answer
25 views

Google scripts sheets “Cell out of range”

I'm trying to fetch the data out of a cell in a range, but i get an error saying the cell i'm trying to read is out of range after opening the document the code goes var range = sheet.getRange("A1:...
-1
votes
0answers
46 views

Looking for suggestion with efficiency in code

I want to make this code more efficient in google sheets. I was told that using it this way would cause me to exceed my allowance using the service. I am asking if anyone knows a better example of ...
0
votes
0answers
59 views

body.findText() does not return what's being searched on

I'm creating a Google Apps Script that creates modular documentation. It's controlled through several tabs on a Google spreadsheet. It basically combines small source docs into a larger doc based on ...
-2
votes
0answers
28 views

Parsing data from dynamic table with Google Sheet

I'm trying to parse some agricultural produce wholesale prices from a wholesaler website and show on a Google spreadsheet. However, the price data is in a "dynamic table", which is updated according ...
0
votes
1answer
26 views

What is causing this “Cannot set property” error when trying to save to array?

I get the following error when trying to write to an array. TypeError: Cannot set property "1.0" of undefined to "xyz". (line 50, file "Code") I am new to this and not sure how to fix. Minimal ...
0
votes
1answer
22 views

Freezing rows in Sheets with Google Apps throws type error

I'm trying to use GAS to freeze the top row of each sheet. It works, freezes the desired rows, but returns an error: "TypeError: cannot call method setFrozenRows" of undefined (line6, file "...
0
votes
1answer
23 views

push table info in google doc back to linked google sheet

Is there a way to update a google sheet from a google doc that has been linked? Basically, I have a template google doc with a linked google sheet table. I have a script that makes a copy of the ...
1
vote
0answers
49 views

Why does adding image to a google form using Form.addImageItem() result in “Invalid data updating form”?

I'm trying to automatically insert an image from a Google drive into a Google form with the help of a Google script using the addImage function, which has recently stopped working and leads to the ...
-1
votes
0answers
13 views

How to make make on section of a Google Form replicate changes in another section?

I'm creating a Google Form where the first section asks users to choose a number between 1 and 20. Depending on their selection, they will then fill out 1-20 IDENTICAL sections before submitting. E.g. ...
0
votes
1answer
22 views

programatically connect two Spreadsheets so you can IMPORTRANGE without having to manually authorize [duplicate]

First, this is for Enterprise G-Suite. Sharing/publishing outside of work domain is disabled. This is my setup: template Spreadsheet in a folder on team drive 1 destination Spreadsheet in a folder ...
2
votes
0answers
29 views

Can a Google Apps Script running as an editor add-on use the https://www.googleapis.com/auth/drive.file scope?

I'm creating a Google Docs add-on in Google Apps Script, and some of the functionality requires that I use the Google Drive advanced service as described in https://developers.google.com/apps-script/...
-2
votes
0answers
40 views

What does single character dot mean in google search?

I was reading a book about GHDB and i faced this: intitle:index.of results:36,000 intitle:"index of" results:18,000 so , what does dot character mean in search ?
-1
votes
0answers
43 views

Custom message after submitting a Google Form through Email

I made a Google form that redirects to a custom 'thank you' page on submission. I've modified some of the HTML by utilizing iframes, however, this does not work when I send the form via email (email ...
0
votes
0answers
51 views

How to utilize API call to overwrite/update Google Sheet?

My current API request will post a new Google Sheet every time it runs, but I just want it to either overwrite the existing sheet or just update it with new data. I've tried using different request ...
-1
votes
0answers
29 views

How do I name a range programmatically without specifying the range?

I have code that lists each sheet in the workbook and displays them in a single column. I'd like to add formulas to subsequent columns that references that list. However, each time I run the code ...
0
votes
1answer
33 views

Getting Error When Clearing Cells - Simple Script

I have a very simple script that is supposed to clear cells in a sheet. I have removed all of the script but one line to try and narrow it down but I am still getting We're sorry, a server error ...
0
votes
2answers
41 views

How I can start a HtmlService directly on file start (onOpen)?

I have created this simple script in a Google Sheet: function onOpen() { SpreadsheetApp.getUi() .createMenu("My Private Menue") .addItem('My html Dialog', 'StartMessage') .addToUi(...
1
vote
0answers
15 views

Using Multiple Stringed Ranges and Combining them into one Array

I have a script running that grabs all of the sheet names and spits it out into a column A. I took these names and then concatenated "Sheet1" with a range "!A2:D" to create a series of stringed values ...
1
vote
1answer
32 views

Programatically create a Google Sheet and get it's JSON URL

I have a Google Apps Script that will copy a spreadsheet from one team drive to another team drive and then publish the new spreadsheet. I want to get the published URL of a specific sheet or get the ...
1
vote
2answers
39 views

Show an alert dialog/pup-up visible to all users in a Google Spreedsheet

I have Google spreadsheet that it's edited with "Anyone with the link can edit" rights, by multiple people (8-10) at the same time. I am the owner and maintainer of that file and occasionally i want ...
-1
votes
0answers
30 views

Need help creating for loop to get checkbox responses so I can make condition statements

I'm creating a form that will get the responses from the checkboxes and if it's check out it will decrement a variable associated with the total count of each option, if it's check in it will ...
0
votes
1answer
18 views

My question is about Google sheet looping through a range of cells and ranking scores

Embedded is an image of what I need to do for some teachers in the school system I work in. Column A has the scores, and in column B I need to be able to rank the scores. The rank number starts at 1 ...
-1
votes
0answers
24 views

Why is loop working this way and other question?

I have complied this code from a variety of sources and I am not 100% sure how it is working so I do have a couple questions. since the variable allShts is in a loop I was thinking it would save an ...
0
votes
0answers
27 views

Uploading An Image With Google Apps Script To A GSheet - Passing Values To And From HTML Service Modal Dialog

I'm trying to trigger a file upload off of a Google Sheet, taking the uploaded file, add it to a Google Drive folder, and then return the URL of the uploaded file and place it in a cell on the Sheet. ...
0
votes
0answers
27 views

google App script - replace formula with static values if condition is met

Trying to come up with a Google App Script that replaces formula outputs with static values for previous weeks. Here is Sample Google Sheet https://docs.google.com/spreadsheets/d/...
0
votes
1answer
35 views

iterate through rows if x push to another spreadsheet

I have the script mostly working- except the data being pushed actually says "Range" I must be missing something- can you not set values across a range? function up4Grabs() { var sheet1 = ...
0
votes
1answer
21 views

Code working via editor but not when opening spreadsheet

I want to open a specific sheet in one spreadsheet depending on the value in another spreadsheet. And it works very good when run directly from script editor but it doesn't work when opening the ...
0
votes
1answer
36 views

how to handle mysql result query to send them over big query table

I'm writing a Google Apps Script to send data from a Mysql Database to a Big Query table. I know how to query a mysql data base. I know how to write data from csv file or a Google sheets into Big ...
0
votes
0answers
25 views

Is there a way to define named ranges through Google Docs GUI?

I know that Named Ranges are a feature of Google Docs, but I can't seem to find any way to define/assign them using the GUI. Is this possible or can it only be done programmatically via Google Apps ...
0
votes
2answers
24 views

How to send a conditional email based on the value of a cell from a form response?

I have a formula that calculates a number based on the response from a google form. Depending on what this number I want to send an email using details from the from as well as a pre typed email in ...
1
vote
2answers
31 views

Google App Script - DriveApp - getParents() not working as expected

MyDrive |_ Client |_ tpl |_ intake.doc I'm trying to get a reference to the MyDrive folder. var tpl_intakeDoc = DriveApp.getFileById(docIDs.tpl_intake); var parent = tpl_intakeDoc.getParents()...
0
votes
1answer
14 views

getMonth function cannot be found

I am trying to get a sheet to populate data in a new tab, I need three columns type, service and date/month. However, the getMonth statement keeps throwing an error and I'm unsure why? var service = ...
1
vote
1answer
39 views

How to format the date in Google Sheets using Apps Script?

I am using Google Apps Script to create custom reports in Google Sheets. The data that I am putting in Google Sheets is coming from JSON data that I am parsing in. One of my columns contains a date ...
2
votes
1answer
38 views

How do I fetch and parse JSON data to Google Sheets Script?

EDIT*** Modified the question now that I have a proper source... I am trying to copy a communication log to Google Sheets and don't know enough about scripting ( or JSON for that matter) to pull this ...
0
votes
1answer
28 views

Get value return of function form file gs to use in function file script

I have 2 files, 1 code .gs file and 1 .html file. I want get value return of function in file gs and call it in function file html script? code in file funcs.gs: function func1(){ var ss = ...
0
votes
0answers
21 views

How to show/display Authorization URL hyperlink once opening in a Spreadsheet after making a copy file?

I have Spreadsheet A which has a google script inside and fully authorized. Now, I want to make a copy from that file to become Spreadsheet B. Of course, google script will be included but never been ...
0
votes
1answer
26 views

How can I add borders to the result?

I am copying three cells from Spreadsheet 1 to the last row of Spreadsheet 2. Now I want to set borders on those three cells in Spreadsheet 2. I have already tried duplicating the first part of the ...