Last active
March 30, 2023 18:20
-
-
Save bpwebs/e7336e7154f29d57e82b419000f01ed8 to your computer and use it in GitHub Desktop.
Google Sheets - Copy data from one sheet to another
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
Google Sheets copy data from one sheet to another |
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 copyData(){ | |
const ss = SpreadsheetApp.getActive(); | |
const copyFrom = "currentPrice"; | |
const copyTo = "priceHistory"; | |
const copyRange = "A7:E7"; | |
const sourceSheet = ss.getSheetByName(copyFrom); | |
const destSheet = ss.getSheetByName(copyTo); | |
const sourceValues = sourceSheet.getRange(copyRange).getValues(); | |
for(let i=0; i<sourceValues.length; i++){ | |
destSheet.appendRow(sourceValues[i]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment