title: BigQuery: Permission denied while getting Drive credentials - Unable to resolve the error
body: <p>I was hoping to get some help with this error code I have been coming across.</p>
  <p><strong>Context</strong>:</p>
  <ul>
  <li>The company I work for use the GSUITE product.</li>
  <li>My team have their own Cloud Project setup.</li>
  <li>Google Drive isn't a &quot;personal&quot; drive.</li>
  <li>We utilise Airflow to refresh our BigQuery tables on a
  daily/weekly/monthly basis.</li>
  </ul>
  <p>I have followed these solutions</p>
  <p><a href="https://stackoverflow.com/questions/66598784/access-denied-permission-denied-while-getting-drive-credentials">Access Denied: Permission denied while getting Drive credentials</a></p>
  <p><a href="https://stackoverflow.com/questions/40731823/encountered-an-error-while-globbing-file-pattern-error-when-using-bigquery-api">&quot;Encountered an error while globbing file pattern&quot; error when using BigQuery API w/ Google Sheets</a></p>
  <p>And also referenced
  <a href="https://cloud.google.com/bigquery/external-data-drive#python_3" rel="noreferrer">https://cloud.google.com/bigquery/external-data-drive#python_3</a></p>
  <p><strong>Problem</strong></p>
  <p>Cloud Composer : v 1.12.0</p>
  <p>I have recently setup an external Bigquery table that reads a tab within a Google Sheet. My Airflow DAG has been failing to complete due to the access restriction to Drive.
  I have added the following to the Airflow connection scopes:</p>
  <p><a href="https://i.stack.imgur.com/JddVe.png" rel="noreferrer">airflow scopes</a></p>
  <p>And also added the service account e-mail address to the Google Sheet the table is referencing via Share. I have also updated the Service account IAM roles to BigQuery admin. After following these steps, I still receive the error BigQuery: Permission denied while getting Drive credentials.</p>
  <hr />
  <p><strong>Problem2</strong></p>
  <p>Following the above, I found it easier to trouble shoot in local, so I created a VENV on my machine because its where im most comfortable troubleshooting. The goal is to simply query a Bigquery table that reads a Google sheet. However, after following the same above steps, I am still unable to get this to work.</p>
  <p>My local code:</p>
  <pre><code>import dotenv
  import pandas as pd
  from google.cloud import bigquery
  import google.auth
  
  def run_BigQuery_table(sql):
      dotenv.load_dotenv()
      credentials, project = google.auth.default(
          scopes=[
              &quot;https://www.googleapis.com/auth/cloud-platform&quot;,
              &quot;https://www.googleapis.com/auth/drive&quot;,
              &quot;https://www.googleapis.com/auth/bigquery&quot;,
          ]
      )
      bigquery.Client(project, credentials)
      output = pd.read_gbq(sql, project_id=project, dialect='standard')
      return output
  
  script_variable = &quot;SELECT * FROM `X` LIMIT 10&quot;
  
  bq_output = run_BigQuery_table(script_variable)
  print(bq_output)
  
  </code></pre>
  <p><strong>My error</strong>:</p>
  <blockquote>
  <p>raise self._exception
  google.api_core.exceptions.Forbidden: 403 Access Denied: BigQuery BigQuery: Permission denied &gt; while getting Drive credentials.</p>
  </blockquote>
  <blockquote>
  <p>raise GenericGBQException(&quot;Reason: {0}&quot;.format(ex))
  pandas_gbq.gbq.GenericGBQException: Reason: 403 Access Denied: BigQuery BigQuery: Permission &gt; denied while getting Drive credentials.</p>
  </blockquote>
  <p>Is anyone able to help?</p>
  <p>Cheers</p>