I have a google doc that I am using as a template for creating thousands of automated reports. One part of that is to replace some of the images from the template and replace them with the correct image. I am struggling to get the ID of the image to replace, which doesnt sound like it should be very complicated. According to these docs https://developers.google.com/docs/api/ ... agerequest,
Код: Выделить всё
The ID of the existing image that will be replaced. The ID can be retrieved from the response of a get request.
Код: Выделить всё
document = docs_service.documents().get(documentId=document_id).execute()
Код: Выделить всё
positionedObjectIds
Here is the code with the missing field:
Код: Выделить всё
requests = [
{
"replaceImage": {
"imageObjectId": ¿where do I get this?,
"uri": f"https://drive.google.com/file/d/{image_id}/view?usp=drive_link",
"imageReplaceMethod": "CENTER_CROP",
}
}
]
Источник: https://stackoverflow.com/questions/781 ... python-api