0

I'm working on datalab but when I try to query a table in bigquery I get the following error:

Exception: invalid: Error while reading table: .... error message: Failed to read the spreadsheet. Errors: No OAuth token with Google Drive scope was found.

This only happens with the tables that are linked with google drive sheet.

now enable the google drive app in gcp

from google.cloud import bigquery

client = bigquery.Client()
sql = """
SELECT * FROM `proyect-xxxx.set_xxx.table_x` LIMIT 1000
"""
df = client.query(sql).to_dataframe()

project_id = 'proyect-xxxx'
df = client.query(sql, project=project_id).to_dataframe()
df.head(3)
nathancy
  • 42,661
  • 14
  • 115
  • 137
  • This appears to be a duplicate of https://stackoverflow.com/questions/46370970/using-google-datalab-trying-to-import-data-from-google-drive?rq=1 – Tim Swast Apr 20 '19 at 20:49
  • Possible duplicate of [Using Google Datalab, trying to import data from Google Drive](https://stackoverflow.com/questions/46370970/using-google-datalab-trying-to-import-data-from-google-drive) – recnac Apr 26 '19 at 01:38

1 Answers1

1

Exception: invalid: Error while reading table: .... error message: Failed to read the spreadsheet. Errors: No OAuth token with Google Drive scope was found.

As state by the error you are trying to access Google Drive, Which store you BigQuery external table, without providing permission to your oAuth token

You will need to go to Google Console and enable this access to solve your problem.

You can use this link which provide a how-to explanation on this subject

Visit the Google API Console to obtain OAuth 2.0 credentials such as a client ID and client secret that are known to both Google and your application. The set of values varies based on what type of application you are building. For example, a JavaScript application does not require a secret, but a web server application does.

Tamir Klein
  • 3,514
  • 1
  • 20
  • 38