added helper script
This commit is contained in:
1 file changed
+94
@@ -0,0 +1,94 @@
|
||||
function helpper() {
|
||||
var ss = SpreadsheetApp.getActiveSpreadsheet();
|
||||
var sheet = ss.getSheetByName("Oct 26");
|
||||
|
||||
var date = new Date();
|
||||
var year = Utilities.formatDate(date, "Atlantic/Canary", "yy");
|
||||
|
||||
var onetwo
|
||||
var cell
|
||||
var cellbefore
|
||||
var datecell
|
||||
var coursecell
|
||||
|
||||
var values = sheet.getRange(1, 1, 877, 1).getValues();
|
||||
|
||||
//Code
|
||||
//====================
|
||||
|
||||
for (var i = values.length - 1; i >= 0; i--){
|
||||
|
||||
let cell = values[i][0];
|
||||
var forcell = sheet.getRange(i, 1);
|
||||
|
||||
|
||||
//Paste WORKING3
|
||||
if (cell instanceof Date && cell >= year) {
|
||||
|
||||
if(cellbefore && cellbefore.getTime() === cell.getTime()){
|
||||
onetwo = 1;
|
||||
}
|
||||
else{
|
||||
onetwo = 2;
|
||||
}
|
||||
|
||||
//console.log(onetwo);
|
||||
|
||||
cellbefore = cell;
|
||||
|
||||
var ziel = forcell.offset(2,1);
|
||||
ziel.activate();
|
||||
|
||||
//Pause
|
||||
SpreadsheetApp.flush();
|
||||
//var weiter = pause();
|
||||
//if (!weiter) return;
|
||||
//------
|
||||
|
||||
if(onetwo == 1){
|
||||
datecell = ziel.offset(-1,-1).getA1Notation();
|
||||
ziel.setValue('=WORKING1('+ datecell +';"surf")');
|
||||
}
|
||||
else{
|
||||
datecell = ziel.offset(-1,-1).getA1Notation();
|
||||
coursecell = ziel.offset(0,8).getA1Notation();
|
||||
ziel.setValue('=WORKING3('+ datecell +';"surf";'+ coursecell +')');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Paste Second
|
||||
if(cell == 9){
|
||||
|
||||
var ziel = forcell.offset(1,0);
|
||||
ziel.offset(-10,0).activate();
|
||||
SpreadsheetApp.flush();
|
||||
ziel.activate();
|
||||
|
||||
//Pause
|
||||
SpreadsheetApp.flush();
|
||||
//var weiter = pause();
|
||||
//if (!weiter) return;
|
||||
//------
|
||||
|
||||
sheet.insertRowsBefore(i + 1, 2);
|
||||
|
||||
ss.getSheetByName("template").getRange('A20:U21').copyTo(ziel, SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
|
||||
|
||||
datecell = ziel.offset(0,0).getA1Notation();
|
||||
coursecell = ziel.offset(11,9).getA1Notation();
|
||||
ziel.offset(1,1).setValue('=WORKING2('+ datecell +';"surf";'+ coursecell +')');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function pause(){
|
||||
var ui = SpreadsheetApp.getUi();
|
||||
|
||||
var antwort = ui.alert(ui.ButtonSet.OK_CANCEL);
|
||||
return antwort == ui.Button.OK;
|
||||
}
|
||||
Reference in new issue
Block a user