title: Google Sheets custom function bug "Unknown function" after successful run
body: <p>In a Google Sheet cell, a custom function is being called through <code>=sheetName()</code> to run the following script (that will return current sheet name):</p>
  
  <pre><code>function sheetName() {
    return SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getName();
  }
  </code></pre>
  
  <p>On first edit (code insertion in cell) the function works properly, but since the sheet is renamed the function won't work as the cell (calling the custom function) content is not updated. Editing again the cell will show the error "Unknown function":</p>
  
  <p><a href="https://i.stack.imgur.com/bceyl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bceyl.png" alt="enter image description here"></a></p>
  
  <p>At this point, some editing in the "offending" cell, will correctly run again the custom function...</p>
  
  <p>Any idea why the function will only work when cell content is edited and wont run when sheet "tab" is renamed?</p>