'How to Ctrl+Shift+Down using Google app scripts
I am trying to write an Google App Script for a google sheet that I have. The number of values I have in column D will change every week, and I am trying to copy those values to paste into another sheet.
So far, I can't find any code that will do the equivalent of selecting D2, and doing a Ctrl + Shift + down + copy.
function ELATerminationTransfer() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('D2').activate();SpreadsheetApp.getSelection().getCurrentCell().getNextDataCell(SpreadsheetApp.Direction.DOWN).activate};
Anyone know of a simple fix?
Solution 1:[1]
You can select by this way
function myFunction(){
var cel = SpreadsheetApp.getActiveRange()
var end = cel.getNextDataCell(SpreadsheetApp.Direction.DOWN)
var rng = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange(cel.getA1Notation()+':'+end.getA1Notation()).activate()
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mike Steelson |

