Last active
April 10, 2020 05:02
-
-
Save joshm21/650b244ce76615c55b6fd112ca0b1b06 to your computer and use it in GitHub Desktop.
Split range into an array of ranges representing the rows of the original range #google-apps-script #range
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function splitRangeIntoRows(range) { | |
const sheet = range.getSheet(); | |
const firstRow = range.getRow(); | |
const lastRow = firstRow + range.getNumRows() - 1; | |
let rows = []; | |
for (let rowIndex = firstRow; rowIndex <= lastRow; rowIndex++) { | |
rows.push(sheet.getRange(`${rowIndex}:${rowIndex}`)); | |
} | |
return rows; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment