title: How can my Google Apps Script be run by others the Sheet is shared with?
body: <p>I've got a Google Apps Script that works fine for me. Others who the sheet is shared with that try to use it get the message: </p>
  
  <blockquote>
    <p>You do not have access to perform that action. Please ask the owner of
    this item to grant access to you.</p>
  </blockquote>
  
  <p>The script is used to update an existing sheet with new rows of data. It's triggered using a menu item added to the UI and does the following:</p>
  
  <ul>
  <li>Finds a .xlsx file in a GDrive folder (this file is exported by a web service and manually placed by us into the GDrive Folder, we have no control over the contents of the file or its format)</li>
  <li>Converts the file from .xlsx to .gsheet using UrlFetchApp (uploadType=media&amp;convert=true)</li>
  <li>Changes the filename and folder location of the resulting .gsheet using UrlFetchApp. The folder location now matches that of the .xlsx file (when a file is converted using UrlFetchApp the resulting file seems to be placed in the root of GDrive)</li>
  <li>Gets the .gsheet using DriveApp and then opens it for access by the script</li>
  <li>Stores all the data from the .gsheet into a 2d array using column headers as the keys for each element in a row</li>
  <li>Stores all the ID values (unique) of the existing data from the destination sheet into a 1d array</li>
  <li>Compares the two arrays and removes any rows from the 2d array that contain an ID that matches one in the 1d array, leaving only new data in the 2d array</li>
  <li>Loops through each row of the 2d array and then through each column of the destination sheet adding data from the 2d array row to a new row at the bottom of the data in the destination sheet, using the value of the column header as the key for each element</li>
  </ul>
  
  <p>I know there's no problem with the code because it works fine for me so it must be a problem with permissions, but I can't figure out how. The sheet is shared with them and the GDrive folder that the files are stored in is shared with them. When I first ran the script myself, I had to grant permissions for the script to access the GDrive folder, which has obviously now been done.</p>
  
  <p>I'm the developer of our group and not the user of the data but atm I'm having to run the script to update the data for the users every time it needs doing instead of them just doing it themselves, which is... annoying.</p>
  
  <p>Any help in trying to figure out where the problem is here greatly appreciated.</p>
  
  <p><strong>EDIT:</strong> Reading through this again its occurred to me that when the file is converted, at first its saved to the GDrive root which is why I then have to change the folder. Being the root, it's not shared with the users of this file. Could this be the reason? If so, how can I get around this? Can I specify at convert time which folder the resulting file should be saved to?</p>