title: Downloading all tabs of a spreadsheet Google Drive API
body: <p>I'm trying to download the full content of a spreadsheet using google Drive. Currently, my code is exporting and then writing to a file the content from the first tab from the given spreadsheet only. How can I make it download the full content of the file?</p>
  <p>This is the function that I'm currently using:</p>
  <pre><code>def download_file(real_file_id, service):
      try:
          file_id = real_file_id
          request = service.files().export_media(fileId=file_id,
                                                 mimeType='text/csv')
          file = io.BytesIO()
          downloader = MediaIoBaseDownload(file, request)
          done = False
          while done is False:
              status, done = downloader.next_chunk()
              print(F'Download {int(status.progress() * 100)}.')
  
      except HttpError as error:
          print(F'An error occurred: {error}')
          file = None
  
  
      file_object = open('test.csv', 'a')
      file_object.write(file.getvalue().decode(&quot;utf-8&quot;))
      file_object.close()
      
      return file.getvalue()
  
  
  </code></pre>
  <p>I call the function at a later stage in my code by passing the already initialised google drive service and the file id</p>
  <pre><code>download_file(real_file_id='XXXXXXXXXXXXXXXXXXXXX', service=service)
  </code></pre>