Using the google drive API to download a spreadsheet in csv format

前端 未结 7 783
执笔经年
执笔经年 2020-11-30 19:10

I\'m sorry if this is an obvious question, I\'m still pretty new to the API. I\'m using the python drive api library, and trying to download a google spreadsheet as a csv.

7条回答
  •  星月不相逢
    2020-11-30 19:53

    Here's an implementation of Alain's suggestion that works for me:

    downloadUrl = entry.get('exportLinks')['application/pdf']
    # Strip "=pdf" and replace with "=csv"
    downloadUrl = downloadUrl[:-4] + "=csv"
    
    resp, content = drive_service._http.request(downloadUrl)
    

提交回复
热议问题