我想弄清楚如何重命名谷歌幻灯片演示文稿(即文档,而不是单个幻灯片)。我已经完成了大量的 Google Slide API Request documentation,但仍在努力寻找正确的请求。在我的示例中,目标是将 google 演示文稿重命名为“hello-world”。
由于我找不到正确的字段,当我去执行下面的代码时,我不断收到以下错误:
df %>%
mutate(Colour = ifelse(
Result == "void",
lead(Colour),
Colour))
# A tibble: 4 x 3
ID Colour Result
<dbl> <chr> <chr>
1 1 red positive
2 2 blue positive
3 3 green void
4 4 green negative
我已经尝试尽可能多地处理请求,但似乎仍然无法弄清楚。下面提供的是代码。非常感谢任何帮助。
<HttpError 400 when requesting https://slides.googleapis.com/v1/presentations/[PRESENTATION ID]:batchUpdate?alt=json returned "Invalid JSON payload received. Unknown name "Presentation" at 'requests[0]': Cannot find field.". Details: "[{'@type': 'type.googleapis.com/google.rpc.BadRequest', 'fieldViolations': [{'field': 'requests[0]', 'description': 'Invalid JSON payload received. Unknown name "Presentation" at \'requests[0]\': Cannot find field.'}]}]">
答案 0 :(得分:1)
正如 Yuri 提到的,Drive API 会更合理。
new_title = 'hello-world'
file = {'title': new_title}
response = service.files().patch(fileId=file_id,
body=file,
fields='title').execute()