I have a google sheet where I require users to edit certain cells with all other cells locked and with a tick to reset script button, but I would like to know if its possible to lock the script from being edited, everything works fine just need to lock the script.

Link to script to have an idea: https://docs.google.com/spreadsheets/d/1j6mf3bt3K2TZS3lzhYWLDeoovWiWs1I3lyLHItJCVMg/edit#gid=0

Script below

function onEdit(e) {
  if (e.value !== 'TRUE') return;
  if (e.range.rowStart !== 6 || e.range.columnStart !== 6) return;
  let sheet;
  if ('Items' !== (sheet = e.range.getSheet()).getName()) return;
  const rangeList = sheet.getRangeList([
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Jan 14 at 6:47

1 Answer 1


There is currently (January 2024) no turnkey way to prevent users who have editor access to a Google Sheet from modifying a script project bound to that Google Sheet.

The supported way to use Apps Script code with a Google Sheet so that editors cannot view or modify the code is to implement the script project separately as an add-on. There is a learning curve, which makes the process impractical with simple script projects such as the one quoted in the question.

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