Skip to main content
22 votes
Accepted

Diference between onEdit or onChange trigger?

based on a quick search these are the differences between onEdit(e) and onChange(e): onEdit(e): brief description: The onEdit(e) trigger runs automatically when a user changes the value of any ...
user0's user avatar
  • 26.7k
6 votes

How to make Google Sheets jump to today's row when opened?

If you are open to use filters and to hide the other rows, use a filter / filter view with Filter by condition set to Date is > Today Comparison to other alternatives This will work for editors and ...
Rubén - Volunteer Moderator -'s user avatar
5 votes

How to make Google Sheets jump to today's row when opened?

It's much simpler now in 2017 :) Simply add "&range=A6" after the URL of the Google Sheet. The "&range" is the range that you want the cursor to be at, and the "A" is for the column, and the ...
gdesmedt1's user avatar
5 votes

How to make Google Sheet jump to today's column when opened?

try this code: function onOpen() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getActiveSheet(); var range = sheet.getRange("2:2"); var values = range.getValues(); values = ...
Max Makhrov's user avatar
4 votes

How to make Google Sheet jump to today's column when opened?

If your dates are in column A, and you want your file to be opened on today's row: In your google sheet: add this in the cell A1: =match(TODAY();A2:A;0)+1 It will return the row number which ...
JinSnow's user avatar
  • 471
4 votes

onEdit only updates top row after pasting (editing) multiple rows

onEdit can be written to take an event parameter that among other things contains the range that was edited. Changing the function declaration to take a parameter 'event' and changing r to be event....
Jared Pinkham's user avatar
4 votes

Script to copy values only

Your last line has a mislaid close-paren. Rather than: sheet.getRange(range.getRow(), 1, 1, sheet.getLastColumn()).copyTo(targetRange), {contentsOnly:true}; the copyTo "options"-object parameter ...
Joel Reid's user avatar
  • 700
3 votes
Accepted

How can I have onEdit trigger when specific cells are selected?

Add getValue() to var r = sheet.getRange("D11");. The resulting code line is: var r = sheet.getRange("D11").getValue(); The above because getRange returns Range object which not return directly it'...
Rubén - Volunteer Moderator -'s user avatar
3 votes

How do you create an installable trigger for a Google Apps Script?

Short answer It's not possible to populate a Google Form ListItem based on the user using the form as respondent. Explanation Google Forms has two main views: Editor view: Available to the form ...
Rubén - Volunteer Moderator -'s user avatar
3 votes

Google Sheets Script Editor action not applying to all sheets

Get the sheet that was edited. Change code to: var sheet, ss; ss = SpreadsheetApp.getActiveSpreadsheet(); sheet = ss.getActiveSheet();//Get the active sheet Now the sheet variable is the active ...
Alan Wells's user avatar
3 votes
Accepted

TypeError: Cannot read property 'range' of undefined at onformsubmit again after creating an event object

How to Fix your problem Manually install the onFormSubmit trigger. When installing the Trigger, under "Choose which function to run", choose the function onFormSubmit (the trigger event argument () ...
Tedinoz's user avatar
  • 5,741
3 votes

Hide/Unhide rows based on values in particular cells

When you have two onEdit(e) functions in the same script project, only one of them will run. The simplest pattern to combine two onEdit(e) functions is to rename the existing functions to ...
doubleunary's user avatar
  • 14.9k
2 votes

How to make Google Sheets jump to today's row when opened?

Adding to gdesmedt1's post and answering the following question: Ok, but is it possible to link to something like &range=today's_date ? – JinSnow The answer is yes! First, right click on any ...
S.Tree's user avatar
  • 21
2 votes

How to make Google Sheets jump to today's row when opened?

Loop through all days column and then: if (day == new Date()) { //then get cell sheet.setCurrentCell(cell); } using this method
kiki's user avatar
  • 21
2 votes
Accepted

Is there any way to identify a user in Google Apps Script?

I searched for this earlier and figured out that it depends if you have private accounts or part of the same company. For private accounts it's not possible, at least it was not when I researched. My ...
Ingeborg's user avatar
  • 198
2 votes
Accepted

Can I limit how frequently an 'on open' script runs?

Say I'm forgetful, but I don't want to pester my coworker by calling her more than every two hours. I might remind myself just by jotting down when I call, so I can glance at that note next time I'm ...
Joel Reid's user avatar
  • 700
2 votes

Trying to run two scripts on same sheet and getting error

You're missing the text "function" in front of oneditfx1 and oneditfx1. Also, your huge if/else if statement could be simplified by using a switch statement and nesting furthers ifs within that.
Eric Palmer's user avatar
2 votes
Accepted

Determining location of checkbox that activated a script?

Use on edit / on change triggers and the corresponding event object. Example function onEdit(e){ var a1Notation = e.range.getA1Notation(); e.source.toast(a1Notation + ' was clicked'); } Related ...
Rubén - Volunteer Moderator -'s user avatar
2 votes

Prevent a Google Script from Modifying Date

Whenever any text is entered in a cell, you want to convert it to uppercase. But your script applies to all kinds of types (includes dates and numbers) and this has undesirable results. Javascript ...
Tedinoz's user avatar
  • 5,741
2 votes
Accepted

Google Sheets: On change, delete a specific row if a certain cell is blank

and there you have it: function myFunction() { var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("preEnrollment"); var sheet2 = SpreadsheetApp.getActiveSpreadsheet()....
dea's user avatar
  • 63
2 votes

Creating a reset button

Welcome! There are several easy ways to get this job done. One of them is macro (see Automate tasks in Google Sheets). Step by step: Start macro recording, make sure "Use absolute references&...
JohnSUN's user avatar
  • 871
2 votes
Accepted

Buttons don't work on iPad with Google Sheets - the onEdit(e) workaround isn't working. Suggestions?

Event object fields are text strings, but if you use .getRange().getValue() to get the real value in a cell, the possible values of a checkbox cell with default settings are the Booleans true and ...
doubleunary's user avatar
  • 14.9k
2 votes
Accepted

Determine if onEdit() was triggered by inserting or removing a row

row and column information isn't available via onChange() You can determine the active row and column in an installable "on change" trigger like this: const ss = SpreadsheetApp.getActive()...
doubleunary's user avatar
  • 14.9k
2 votes

Prevent edits to an Apps Script project bound to a Google Sheet

There is currently (January 2024) no turnkey way to prevent users who have editor access to a Google Sheet from modifying a script project bound to that Google Sheet. The supported way to use Apps ...
doubleunary's user avatar
  • 14.9k
1 vote

Google Sheets onEdit - Run Two Scripts

nested scenario: function onEdit(e) { moveRowsFromSheetToSheet_(e); } function moveRowsFromSheetToSheet_(e) { // start of code if(condition == met) { //operation to follow } //closes if ...
user0's user avatar
  • 26.7k
1 vote

How can I have onEdit trigger when specific cells are selected?

I tried this and its actually worked . function onEdit(e) { var sheet = SpreadsheetApp.getActiveSheet(); var r = sheet.getRange("L2").getValue(); if (r == 'ADD'){ // Add your code here }}
Aboude zoua's user avatar
1 vote

How to trigger a script in Google sheets when a value changes

onChange isn't a reserved word for a simple trigger on Google Apps Script but there is an "on change" installable trigger that could execute a specified function regardless of it's name. ...
Rubén - Volunteer Moderator -'s user avatar
1 vote

How to execute a trigger only when one of the sheets is changed

function onEdit(){ var sheet = SpreadsheetApp.getActiveSheet().getSheetName() if(sheet === 'your sheet name') { ///your code } This only executes the code ONLY IF 'your sheet name' was edited.
Arthur Futoryan's user avatar
1 vote
Accepted

onEdit stops working when other function is run

It was the line var historySheet = SpreadsheetApp.openById('spreadsheetID'); This requires authentication and therefore cannot be run by simple triggers such as onOpen() or onEdit(). moving the ...
M Tut's user avatar
  • 11

Only top scored, non community-wiki answers of a minimum length are eligible