Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bpwebs/e7336e7154f29d57e82b419000f01ed8 to your computer and use it in GitHub Desktop.
Save bpwebs/e7336e7154f29d57e82b419000f01ed8 to your computer and use it in GitHub Desktop.
Google Sheets - Copy data from one sheet to another
Google Sheets copy data from one sheet to another
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