title: Get the file ID of a Library
body: <p>The basic case is 2 files:</p>
  
  <ol>
  <li>Admin file. Library.</li>
  <li>User file.</li>
  </ol>
  
  <p>I use a library file as admin file, and store some settings on its sheet. In a User file, I have a code, that needs an access to Admin file.</p>
  
  <p>The code in a library:</p>
  
  <pre><code>SpreadsheetApp.getActive();
  </code></pre>
  
  <p>won't work, it will return the User file when running from a library.</p>
  
  <hr>
  
  <p>Is there a code to have an access to a library file (spreadsheet)? </p>
  
  <p><a href="https://i.stack.imgur.com/WS5s1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WS5s1.png" alt="enter image description here"></a></p>
  
  <p>I need this because do not want to hardcode the ID of a library, in order to make it work with different copies of a library file.</p>
  
  <p>I think of a solution similar to Excel's:</p>
  
  <pre><code>Set book = ThisWorkbook
  </code></pre>
  
  <p>The code in Excel will always return file where the code is.</p>