title: how to launch local application through Google sheet
body: <p>I'm not sure if this is the correct way of achieving the end result but what I have works so far.  I have a Google sheet with multiple tabs of data.  What I would like to do is launch a local Windows application (e.g. mstsc.exe / notepad.exe) when I select a cell on a particular sheet.  I am not even sure if this is possible as I have found no clear answer from searching.</p>
  
  <p>I already make use of the onEdit function to get the active sheet name and cell and then call a sub-function which colors the cell depending on the value set and updates the time stored in a different cell.  Reduced extract of code below: -</p>
  
  <pre><code>function onEdit(){
   var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
   var cell = sheet.getActiveCell();  
   if(SpreadsheetApp.getActiveSheet().getName() === "Test Sheet"){
     if( cell.getColumn() == 3 ) { //checks the column
     // change colors to meet your needs
     ColourCell()
     }
  }
  
  
  function ColourCell(){
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var cell = sheet.getActiveCell();
    // change colors to meet your needs
     var status = cell.getValue();
     var color;
     switch(status ) {
       case "COMPLETE":
         color = "LIME";
         sheet.getActiveCell().setBackgroundColor(color);
         var nextCell = cell.offset(0, 3);
         var time = new Date();
         time = Utilities.formatDate(time, "GMT+1", "HH:mm:ss");
         nextCell.setValue(time)
       break;
       case "OPEN":
         color = "RED";
         sheet.getActiveCell().setBackgroundColor(color);       
         var nextCell = cell.offset(0, 1); 
         var time = new Date();
         time = Utilities.formatDate(time, "GMT+1", "HH:mm:ss");
         nextCell.setValue(time)
       break;
   }
  };
  </code></pre>
  
  <p>What I have tried to do is add a further if statement to the onEdit function which would then call a LaunchApp function as shown below</p>
  
  <pre><code>if(SpreadsheetApp.getActiveSheet().getName() === "Test Sheet"){
   if( cell.getColumn() == 4 ) { //checks the column
    // change colors to meet your needs
    ColourCell()
   }
   if( cell.getColumn() == 1 ) { //checks the column
    // launch mstsc and connect to value in cell
    LaunchApp() 
   }  
  }
  
  
  function LaunchApp(){
  // WHAT CODE NEEDS TO BE ADDED HERE ????
  };
  </code></pre>
  
  <p>But I cannot work out what code would need to go in the LaunchApp function or, as I mentioned earlier, even if this is possible.</p>
  
  <p>Can anyone offer me some help ?</p>
  
  <p>Thanks,</p>