-2

I have configured to fetch the data on every 1 min from investing wesite.

enter image description here

The table data is fetching from website. while trying to update date when 15 minutes status D column change to either strong sell or strong buy time on time and date column the functions are not working. please find below requirement.

1) I need to update time and date in G column when D column update from the website either Strong sell or strong buy. 2) once the time and data updated if the time and date less then 1 minute then need to get email alerts.

I have tried functions on the table but not working. kindly help me on this why the functions are not working .onchange .onedit.

I am using below query but i am not getting alert.

function getData() { 
  var sheetName = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Main"); 

  var queryString = Math.random(); 
  var cellFunction = '=IMPORTHTML("https://www.investing.com/technical/commodities-technical-summary","table",4)';
  var datetime = Utilities.formatDate(new Date(), "IST", "yyyy/MM/dd HH: mm:ss");
    sheetName.getRange('A1').setValue(cellFunction); 
  sheetName.getRange('g2').setValue(datetime);
}

function sendNotification() {
    var sheetName = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Main");   
  //if("D13" == sheetName.range.getA1Notation() || "D12" == e.range.getA1Notation()) {
    if("C13" == "Strong Buy" and "h13"=now() diff 1 minutes) {



  //Define Notification Details
      var recipients = "jaianjaneya@outlook.in";
      var subject = "Update"+e.range.getSheet().getName();
      var body = "cell C13 has been updated";

        var datetime = Utilities.formatDate(new Date(), "IST", "yyyy/MM/dd HH: mm:ss");
      sheetName.getRange('H13').setValue(datetime); 

  //Send the Email
      MailApp.sendEmail(recipients, subject, body);
    }
  }

closed as unclear what you're asking by ale, serenesat, Rubén, jonsca Apr 9 '18 at 22:40

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • This seems like a question for Stack Overflow rather than this site. – freginold Feb 18 '18 at 3:37
  • 1
    It's okay here, I think, but it's tough to decipher what's being asked. Writing out the actual code you are trying would probably help. – jonsca Feb 18 '18 at 8:54
2

onEdit(e) and onChange Triggers(Both simple and Installable) will not trigger unless a human explicitly edits the file. In your case, Your seem to be getting value from an external source (specifically, finance data).

Script executions and API requests do not cause triggers to run. For example, calling FormResponse.submit() to submit a new form response does not cause the form's submit trigger to run.

Script executions and API requests do not cause triggers to run. For example, calling Range.setValue() to edit a cell does not cause the spreadsheet's onEdit trigger to run.

For update in spreadsheet itself,Please refer here to use a script.

  • I am using below query but i am not getting alert. – Murali Pujari Feb 22 '18 at 6:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.