Created
October 5, 2020 13:03
-
-
Save scytacki/0dbd45e35182d4d7fedce585e3f4632f to your computer and use it in GitHub Desktop.
Google spreadsheet function to 'explode' a range based on a column that has a 'count' in it. Each row is duplicated 'count' times.
This file contains hidden or 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 CREATE_CASES(input_range, count_column) { | |
return input_range.map((row) => { | |
let rows = []; | |
for(let i=0; i<row[count_column]; i++){ | |
rows.push(row); | |
} | |
return rows | |
}).flat(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment