Created
October 20, 2022 07:25
-
-
Save bactisme/8027f3baaa5b7743249f6a9a71100b5d to your computer and use it in GitHub Desktop.
Configure the first function. Create a sketch of a button > right click > assign a script > copyPnL in the box > Enjoy
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 copyPnL(){ | |
var uri = "https://docs.google.com/spreadsheets/d/1pNObB_ETC"; | |
var sheetname = "Sheet 1"; | |
var range = "A1:BS500"; | |
var offsetx = 1; | |
var offsety = 1; | |
COPYSHEET(uri, sheetname, range, offsetx, offsety); | |
} | |
function COPYSHEET(spreadsheet_uri, sheetname, range, offsetx = 1, offsety = 1){ | |
var file = SpreadsheetApp.openByUrl(spreadsheet_uri); | |
var sheet = file.getSheetByName(sheetname); | |
var range = sheet.getRange(range); | |
var values = range.getValues(); | |
SpreadsheetApp.getActive().getActiveSheet().getRange(offsetx, offsety,values.length, values[0].length).clear(); | |
SpreadsheetApp.getActive().getActiveSheet().getRange(offsetx, offsety,values.length, values[0].length).setValues(values); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment