How to Convert XLSX to Sheets in Google Drive API v3

In APIv3, you need to specify a very specific MIME Type for the conversion to occur.

At https://developers.google.com/drive/v3/web/manage-uploads#importing_to_google_docs_types_wzxhzdk8wzxhzdk9, you'll notice the statement "The supported conversions are available dynamically in the About resource's importFormats array". Get the importFormats list using either

GET https://www.googleapis.com/drive/v3/about?fields=importFormats&key={YOUR_API_KEY}

or by going to https://developers.google.com/drive/v3/reference/about/get#try-it and entering importFormats

You'll notice in the response:

"application/vnd.ms-excel": [
   "application/vnd.google-apps.spreadsheet"
]

In your code, use:

elif extension in ["xls", "xlsx"]:      # EXCEL
    mime_type = "application/vnd.ms-excel"

(notice the additional vnd.)and it should work well!