title: Google Script runs but get 'do not have permission to call setValues' returned as function
body: <p>In google sheets, I am trying to return an array of results to an array of cells with a single custom function. Much like the "=IMPORT..." or "=QUERY" native functions.  Thanks to user <a href="https://stackoverflow.com/users/4333107/bardy">Bardy</a> and this <a href="https://stackoverflow.com/questions/41052890/google-apps-script-how-to-copy-array-of-objects-to-range/41056694#41056694">original post</a>, I have developed the following script.</p>
  
  <pre><code>function asset() {  
    var s = SpreadsheetApp.getActiveSpreadsheet()
    var ss = s.getActiveSheet()
    var sc = ss.getActiveCell()
    var items = [{Description:'Well',ItemId:'1'},
  {Description:'House',ItemId:'2'}];
  
    var outputRows = []
    var headings = ["Description","ItemId"]
  
    items.forEach(function(item){
      outputRows.push(headings.map(function(heading){
        return item[heading] || '';
       }));
    });
  
    if (outputRows.length){
      outputRows.unshift(headings);
  SpreadsheetApp.getActiveSheet().getRange(1,1,outputRows.length,outputRows[0].length).setValues(outputRows);
    }
  }
  </code></pre>
  
  <p>The scrip works like a charm when I run it, but if I try to call the function from the spreadsheet, I get the vicious </p>
  
  <p>'ERROR:You do not have permission to call setValues (line 18).'</p>
  
  <p>I've scanned the blogs and checked just about every help file, and something isnt connecting.  I think it has something to do with the way I try to activate the cell, but what am I missing?</p>
  
  <p>Note i am aware of similar posts like <a href="https://stackoverflow.com/questions/40806930/no-permission-to-call-setvalues-google-apps-script-json-data">"No Permission to call setValues() - Google Apps Script, JSON data [duplicate]"
  </a> (marked as a dupliacte of <a href="https://stackoverflow.com/questions/10506105/no-permission-to-call-msgbox-in-google-apps-scripting">"No permission to call msgBox in Google Apps Scripting
  "</a>) however i believe my application is a bit different. I AM trying to allow end users to drop the results anywhere in the sheet based on the position of the entered formula.</p>
  
  <p>I think it has something to do with the way I try to activate the cell.  I cant seem to figure out how to make it relative to the location of the entered formula. What am I missing?</p>