title: How to Auth to Google Cloud using Service Account in Python?
body: <p>Im trying to make a project that will upload google storage json file to BigQuery (just automate something that is done manually now).</p>
  
  <p>And i'd like to use 'service account' for this as my script is going to be run on daily basis.</p>
  
  <p>After reading everything i can found about using service account im still struggling to authenticate. </p>
  
  <p>I wonder if someone could check and point me to what i missed?</p>
  
  <p>Here is what i've done so far:</p>
  
  <ol>
  <li>Created json key file for service account</li>
  <li>Installed client libraries: <code>pip install --upgrade
  google-cloud-bigquery</code></li>
  <li>Installed google cloud sdk according to: <a href="https://cloud.google.com/sdk/docs/" rel="noreferrer">https://cloud.google.com/sdk/docs/</a></li>
  <li>Run <code>export GOOGLE_APPLICATION_CREDENTIALS=&lt;path_to_service_account_file&gt;</code> with key path specified correctly</li>
  </ol>
  
  <p>Now im trying to run the following python script:</p>
  
  <pre><code>from google.cloud import bigquery
  bigquery_client = bigquery.Client()
  </code></pre>
  
  <p>i get this error:</p>
  
  <p>google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or
  explicitly create credential and re-run the application. For more
  information, please see
  <a href="https://developers.google.com/accounts/docs/application-default-credentials" rel="noreferrer">https://developers.google.com/accounts/docs/application-default-credentials</a>.</p>
  
  <p>Im quite new to both python and google cloud API so possbily missed something,</p>
  
  <p>Wonder if someone could point out where/what was wrong in my steps above or point me to clear instruction for dummys about setting up and running simple script with Bigquery using service account?</p>