Skip to content

Instantly share code, notes, and snippets.

@franklinokech
Last active March 13, 2019 06:50
Show Gist options
  • Save franklinokech/f1e068b732bac161e27d3a85eba5c3e4 to your computer and use it in GitHub Desktop.
Save franklinokech/f1e068b732bac161e27d3a85eba5c3e4 to your computer and use it in GitHub Desktop.
changes the name of the file and edited move to copy
/*
A function to copy data from one SpreadSheet to another Spreadsheet
*/
function CopyDataToNewFile() {
var sss = SpreadsheetApp.openById('1beVqbhcXrDTUNDiqbgO9Q-VgXau6ixOOc03BMTNFCqM');//Source spreadsheet ID
var ss = sss.getSheetByName('Data');
var SRange = ss.getDataRange();
var SData = SRange.getValues();
var tss = SpreadsheetApp.openById('1aSXgCJfsEtSZfVQJcfZmwWod2xQbds5PHHTX5_O6rFU');//Target spreadsheet ID
var ts = tss.getSheetByName('DataCopy');
ts.getRange(ts.getLastRow()+1,1,SData.length,SData[0].length).setValues(SData);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment