title: Need guidance on creating an Apps script or Sheets formula to match sub-sheet names to a list of unique IDs
body: <p>More detailed information here. I have a list of 16 workbooks with a list of sub-sheets in them organized by last name, numbering anywhere from 15-100 names per workbook. Each person has a unique ID number that needs to be placed in their respective sub-sheet. I have a separate file with the names and IDs that need to be inserted. I need to create either a script or a sheets formula that:</p>
  <p>Iterates over all the sub-sheets, gets the sheet name, finds the name and ID in the other file, inserts the ID into a cell in the correct sub-sheet and then moves on to the next sheet in the workbook. I am very new to Sheets and scripting so I am quite lost. There is a compounding issue as well:</p>
  <ul>
  <li>the sub-sheets are not organized uniformly and are in a mixed format, most are just last name but where duplicate last names exist various conventions are used (ex: Smith, F_Smith, John Smith, are all used within a workbook to refer to 3 different people)</li>
  </ul>
  <p>Since I have a list of all the IDs and people I need this is not a huge deal as the script can just match based on the last name and I can manually change the duplicates.</p>
  <p><a href="https://docs.google.com/spreadsheets/d/18AFpo8vpd7g5ffEEhqBBZZXAmg15lE3q41KbsBosa6w/edit?usp=sharing" rel="nofollow noreferrer">Here is an anonymized sheet with sample names and IDs</a></p>
  <p><a href="https://docs.google.com/spreadsheets/d/1j2VX_HTromOcsRrjDyxqUAu5_YebLor0jXXbba2wIt0/edit?usp=sharing" rel="nofollow noreferrer">Here is an example sheet with last names as sub-sheets</a></p>
  <p>Any help is appreciated, thanks.</p>
  <p>Updated with table for Names and IDs sheet:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>First Name</th>
  <th>Last Name</th>
  <th>ID</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>Dave</td>
  <td>Smith</td>
  <td>247</td>
  </tr>
  <tr>
  <td>Jack</td>
  <td>Smith</td>
  <td>248</td>
  </tr>
  <tr>
  <td>Jane</td>
  <td>Doe</td>
  <td>143</td>
  </tr>
  <tr>
  <td>Evelyn</td>
  <td>Borca</td>
  <td>1292</td>
  </tr>
  <tr>
  <td>Cherie</td>
  <td>Tenny</td>
  <td>1148</td>
  </tr>
  <tr>
  <td>Brent</td>
  <td>Brooks</td>
  <td>285</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Screenshot of workbook with sub-sheets that needs ids inserted based on last name match - <a href="https://i.ibb.co/Ydpqvyn/workbook-example.jpg" rel="nofollow noreferrer">https://i.ibb.co/Ydpqvyn/workbook-example.jpg</a></p>