1
votes

I have created a service account to access the user google sheet to download it in excel format.

Let's say my Domain id is - [email protected] and service account id - [email protected]

When I try to download the google sheet with a google sheet id from the service account I get this error.

Google.Apis.Requests.RequestError
File not found: 1-mhsKJ1THbROA7yXRye3JI6cWANAdiMxoD5fKQ-jvSI. [404]
Errors [
        Message[File not found: 1-mhsKJ1THbROA7yXRye3JI6cWANAdiMxoD5fKQ-jvSI.] Location[fileId - parameter] Reason[notFound] Domain[global]
]

But when I share the google sheet from domain id with the service account id, I am able to download the google sheet.

Can service account access the drive of domain user without sharing the sheets to download it.

1
please include the error not a picture of the error.DaImTo

1 Answers

2
votes

A service account is not you, think of it as a dummy user account.

You file on google drive is private user data owned by you. If you want me to be able to download your file you need to share it with me, the same goes for the service account.

With Oauth2 a window pops up asking the user to grant the application access to the data, service accounts are pre authorized by sharing things with them manually.

A service account cant download files it does not have access to. You need to share the file with it for it to be able to access it.