Reputation: 47
I am new to API's and i am trying to create a google sheet using python. I am able to create google sheet but unable to view/edit(Access issue). I am using Service Account in API's. Please help me in modifying the code to access the created sheets.
Here is the sample code i am using to create one.
service = discovery.build('sheets', 'v4', credentials=credentials)
spreadsheet_body = {
}
request = service.spreadsheets().create(body=spreadsheet_body)
response = request.execute()
Upvotes: 0
Views: 463
Reputation: 26836
If instead you want to create a sheet on YOUR drive, you need to use impersonation:
After enabling domain-wide delegation, you need to impersonate the service account as you.
In python you can do it by specifying credentials = credentials.create_delegated(user_email)
when instantiating the service object.
Upvotes: 0