Drive API access to document with service account

后端 未结 2 836
情话喂你
情话喂你 2021-01-16 22:34

I\'m attempting to access a spreadsheet that\'s under the \"google.com\" domain using the Google Drive Java API through a service account. I need to export several of the wo

相关标签:
2条回答
  • 2021-01-16 23:01

    Do you have access to the file? try to use the method files.get https://developers.google.com/drive/v2/reference/files/get if you receive a 200 response then you have access, try to find the parameter exportlinks with those links you can export the file to different formats. otherwise you won't be able to do it.

    • Only people that have been granted access to the file, can access it. in the case of service account with delegation approved by the domain admin, the service account can impersonate people in that domain. if the user it is impersonating does not have access to a certain file, the service account wont have access either.

    • To export the file is better with the Drive API, as you mentioned the Spreadsheets API is to manage the content of the spreadsheet.

    • If you want to modify the information without modifying the original file, then yes.

    hope this helps.

    0 讨论(0)
  • 2021-01-16 23:01

    You also have to grant the service account in the drive file you want to access to. Just Share the document you want to get access with the EMAIL ADDRESS that appears in the Google Developers Console (e.g. XXXXX@developer.gserviceaccount.com)

    0 讨论(0)
提交回复
热议问题