How to modify image properties in Google Workspace documents using API

I’m trying to change image properties like title, alt text, and styling in Google Docs, Sheets, and Slides through code. I know how to swap out images completely using the batch update method with ReplaceImageRequest, but I can’t figure out how to just update the image attributes without replacing the whole image.

I can read the embedded object data from documents just fine, but when I try to write those same properties back to update an existing image, nothing happens. Has anyone managed to update image metadata programmatically? I’m specifically looking to change things like image descriptions and visual styling without having to replace the entire image file.

Is there a specific API endpoint or request type I should be using for this? The documentation mentions embedded objects but doesn’t clearly show how to modify their properties after they’re already in the document.

Yes, I’ve faced similar issues with manipulating image properties using the API. What worked for me was utilizing the UpdateDocumentRequest with tailored actions based on the specific properties being altered. For modifying alt text and titles, it’s necessary to use the UpdateTextStyleRequest on the embedded image object. The challenge lies in ensuring you have the exact object ID. I typically start by querying the document’s structure to obtain the precise embedded object reference, followed by executing a batchUpdate with UpdateEmbeddedObjectPropertiesRequest. The documentation can be lacking in detail, but this approach allows for editing styles and descriptions without completely replacing the image. Just a heads up: different Google Workspace applications may vary in how they manage embedded objects, so ensure you use the correct service endpoint for each one.

I’ve hit this same wall before. Google Workspace APIs don’t support direct metadata updates for embedded images - it’s frustrating but that’s the reality. Here’s what worked for me: I extracted the image’s existing properties, modified them in memory, then used ReplaceImageRequest with the same image data but updated properties. Not pretty, but it gets the job done. Just make sure you keep the image’s object ID and positioning data intact while updating only the metadata you actually need. Also double-check you’re working with the right embedded object type - images sometimes get categorized differently depending on how they were originally inserted.

totally feel you on this. the google workspace api can be a pain with image stuff. if you’re looking to change attributes, u basically have to replace the image itself. there isn’t a direct way to just tweak the metadata, sadly. good luck!