0
votes

My Python app feeds data into the sheet. I want incoming data to trigger the script.

On spreadsheet side, there is onEdit script, but not triggered by coming inputs. I've also set trigger on form submit in trigger manager, also doesn't work. Any help, how it should be done?

Thanks

1
Well sorry I could not help. I'll just go ahead and delete my answer and perhaps that will encourage others to step in and help you.Cooper

1 Answers

0
votes

It does not work. I've installed the onChange trigger with:

function createSpreadsheetChangeTrigger() {
    var ss = SpreadsheetApp.getActive();
    ScriptApp.newTrigger('onChange')
      .forSpreadsheet(ss)
      .onChange()
      .create();
    } 

I can see it in triggers manager. Python adds row and the script is not fired. Only manual edit triggers the script, below:

function onChange(e) {
  var sheet = e.source.getActiveSheet();
  mit = sheet.getRange(1,12).getValue();
  mat = sheet.getRange(1,13).getValue();
  mih = sheet.getRange(1,14).getValue();
  mah = sheet.getRange(1,15).getValue();
  var chart = sheet.getCharts()[0];
  chart = chart.modify()
    .setOption('vAxes.0.viewWindow.max', mat)
    .setOption('vAxes.0.viewWindow.min', mit)
    .build();
  sheet.updateChart(chart);
  var chart1 = sheet.getCharts()[1];
  chart1 = chart1.modify()
    .setOption('vAxes.0.viewWindow.max', mah)
    .setOption('vAxes.0.viewWindow.min', mih)
    .build();
  sheet.updateChart(chart1);
}