title: Why am I receiving a quota limit error? Google Cloud Platform Compute Engine VM
body: <p>So I have a python script set up in Google Cloud Compute engine that is set to run with a cron tab periodically throughout a day. But recently, the script returns this error,</p>
  <p><strong>gspread.exceptions.APIError: {'code': 429, 'message': &quot;Quota exceeded for quota metric 'Read requests' and limit 'Read requests per minute per user' of service 'sheets.googleapis.com' for consumer 'project_number:583704109550'.&quot;, 'status': 'RESOURCE_EXHAUSTED', 'details': [{'@type': 'type.googleapis.com/google.rpc.ErrorInfo', 'reason': 'RATE_LIMIT_EXCEEDED', 'domain': 'googleapis.com', 'metadata': {'quota_metric': 'sheets.googleapis.com/read_requests', 'quota_limit': 'ReadRequestsPerMinutePerUser', 'service': 'sheets.googleapis.com', 'consumer': 'projects/583704109550'}}]}</strong></p>
  <p>I've tried to do research into why its throwing it but am at a loss due to my inexperience in the field. Here is the script is anyone is wondering,</p>
  <pre><code>from woocommerce import API
  from df2gspread import df2gspread as d2g
  from df2gspread import gspread2df as g2d
  from collections import defaultdict
  import pandas as pd
  import gspread
  from oauth2client.service_account import ServiceAccountCredentials
  def parseData(entry):
          #Extract relectant information (all key value pairs that are listed under meta_data)
          d = {pair[&quot;key&quot;]:pair[&quot;value&quot;] for pair in entry[&quot;line_items&quot;][0][&quot;meta_data&quot;]}
          d[&quot;Event&quot;] = entry[&quot;line_items&quot;][0][&quot;name&quot;]
          return d
  wcapi = API(
      url=&quot;REDACTED&quot;,
      consumer_key=&quot;REDACTED&quot;,
      consumer_secret=&quot;REDACTED&quot;,
      version=&quot;wc/v3&quot;,
      query_string_auth=&quot;true&quot;
  )
  entries = []
  pageNum = 1
  while True:
          #API is paginated with products per page limit of 100
          rawEntries = wcapi.get(&quot;orders&quot;, params = {&quot;per_page&quot;: 100, &quot;page&quot;: pageNum}).json()
          #Page until there are no entries on a page
          if len(rawEntries) == 0:
                  break
          entries.extend([parseData(e) for e in rawEntries])
          pageNum += 1
  rawEvents = defaultdict(list)
  for entry in entries:
          #Organize entries by their event
          rawEvents[entry[&quot;Event&quot;]].append(entry)
  events = {k: pd.DataFrame(v).fillna('') for (k,v) in rawEvents.items()} #Built a dataframe for each event
  #Upload to Google Sheets using gspread and df2gspread
  scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
  credentials = ServiceAccountCredentials.from_json_keyfile_name('/home/shahav2016/GoogleKeyJSON.json', scope)
  gc = gspread.authorize(credentials)
  spreadsheet_key = 'REDACTED FOR PRIVACY REASONS' #The name of the spreadsheet - look at the URL
  for event, df in events.items():
          #Filter out test events
          if event not in ['REDACTED FOR PRIVACY']:
                  #Upload the data to the correct sheet
                  d2g.upload(df, spreadsheet_key, event, row_names = False, credentials = credentials)
  </code></pre>