【发布时间】:2020-05-22 18:34:28
【问题描述】:
我有 100 多张 Google 表格与很多人共享。我正在尝试从访问列表中删除不活跃的人。 python有没有办法从版本历史中提取为谷歌表做出贡献的人的列表? 我使用 gspread 库访问工作表,但不知道如何获取贡献用户列表。
from oauth2client.service_account import ServiceAccountCredentials
from googleapiclient.discovery import build
scope = ['https://www.googleapis.com/auth/drive.activity.readonly']
creds = ServiceAccountCredentials.from_json_keyfile_name('accessAPI.json', scopes = scope)
drive_service = build('driveactivity', 'v2', credentials=creds)
edit_activities = drive_service.activity().query(body={"filter":"detail.action_detail_case:EDIT",
"itemName":"items/xyz",
"consolidationStrategy":"legacy"}).execute()
# Call the People API
scope = ['https://www.googleapis.com/auth/contacts.readonly']
creds = ServiceAccountCredentials.from_json_keyfile_name('accessAPI.json', scopes = scope)
service = build('people', 'v1', credentials=creds)
results = service.people().get(resourceName='people/1080745054',personFields='names,emailAddresses').execute()
通过人员 API 运行人员 ID 会返回以下结果。它不包含电子邮件地址
{'resourceName': 'people/1080745054',
'etag': '%EgcBAj0JPjcuGgQBAgUH'}
输出是否被截断?
【问题讨论】:
标签: python google-sheets google-apis-explorer gspread google-people-api