'OnEdit Assistance in Google Sheets

I am using the onEdit function to try and run an outside script if a certain cell is modified. I can get this to work if I use the following code for a generic replacement of the A2 value, but if I uncomment the call to the outside script and edit D2 nothing happens. I even tried copying the exact code from the outside function into the if statement (instead of calling the function) and that also didn't work.

In this outside script I am parsing JSON data with a couple hundred lines of code so maybe that is an issue?? But the script I'm calling runs great on it's own, outside of the 'onEdit' function. Any input is appreciated. Here is my code:

function onEdit(e){

var range = e.range; var spreadSheet = e.source; var sheetName = spreadSheet.getActiveSheet().getName(); var column = range.getColumn(); var row = range.getRow(); var inputValue = e.value;

if(sheetName == 'Auto DK Lines' && column == 4 && row == 1) {
// getMyData() SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Auto DK Lines').getRange('A2').setValue([inputValue]);

 } 

}

I am ultimately trying to setup a way to activate this code from my mobile device. When I have a laptop I can create a button in the sheets that runs the code but I can't click the button in the mobile app so I am trying to create a workaround. Using the onEdit function has been suggested in what I've read so far.

Thank you!

I tried calling an outside script in the onEdit function if there was a modification to a target cell but this has been unsuccessful so far. I can get it with basic calls inside the if statement but if I paste my outside function (or the actual code of that outside function) into this if statement nothing happens.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source