title: How can I get the code generated by File -> Publish to the web for a Google Doc using Google Apps Script?
body: <p>Using the Google Sheets script editor, I want to get the number starting 2PACX that is in the code generated from File -> Publish to the web for a Google Doc.</p>
  
  <p>Note this is different to fileId(), or the number shown in the normal URL for the doc that starts with 1. Is there another name for it? I've spent ages googling and found nothing. </p>
  
  <p>This <a href="https://stackoverflow.com/questions/50997579/how-to-get-the-id-for-a-published-to-the-web-spreadsheet-in-google-apps-scripts">question</a> is basically the same, but the answer accepted isn't one that actually answers the original question (i.e. getting the 2PACX number programatically). [Already explained the duplicate in this paragraph but editing as it looks like I have to to address the comment below]</p>