title: Google sheets API worksheet id issue / python
body: <p>I want to ask a question related to this: <a href="https://stackoverflow.com/questions/57326175/is-there-a-way-to-autofit-a-column-in-google-sheets-using-gspread-api-for-python/67148241#67148241">Is there a way to autofit a column in Google Sheets using gspread API for Python?</a></p>
  <p>While creating a new sheet the first worksheet or &quot;sheet1&quot; has a gid of: edit#gid=0</p>
  <p>This happens every time you create a new sheet. Only if you add a new worksheet &quot;sheet2&quot; you'll get a sheet gid withs some actual numbers for example: 12345.</p>
  <pre><code>spreadsheetName = &quot;###&quot;  # Please set Spreadsheet name.
  sheetName = &quot;###&quot;  # Please set sheet name.
  
  ss = client.open(spreadsheetName)
  sheetId = ss.worksheet(sheetName)._properties['sheetId']
  body = {
      &quot;requests&quot;: [
          {
              &quot;autoResizeDimensions&quot;: {
                  &quot;dimensions&quot;: {
                      &quot;sheetId&quot;: sheetId,
                      &quot;dimension&quot;: &quot;COLUMNS&quot;,
                      &quot;startIndex&quot;: 0,  # Please set the column index.
                      &quot;endIndex&quot;: 2  # Please set the column index.
                  }
              }
          }
      ]
  }
  res = ss.batch_update(body)
  </code></pre>
  <p>The problem is that &quot;sheetId&quot; : takes only integers. So how do I give the argument &quot;sheetId&quot; corresponding value &quot;edit#gid=0&quot;? And the integer: 0 which comes up if you run the code above does not work.</p>
  <p>Thank you!</p>