I’m working on a Google Docs Add-on using Apps Script. My add-on stores some info in the Document Properties. I want users to be able to undo changes, so I’m thinking about using Google Versions. But I’m not sure if the document properties are included when a version is saved. Does anyone know if the properties are version-specific or if they’re always the most recent ones? This is important for my add-on to work correctly when users roll back to earlier versions. Thanks for any help!
Based on my experience developing Google Workspace add-ons, document properties are not included in version histories. They’re stored separately from the document content. When reverting to a previous version, the properties remain unchanged. For your use case, I’d suggest storing version-specific data within the document itself, perhaps in a hidden section. Alternatively, you could maintain a separate database or use Cloud Storage to keep track of property changes alongside document versions. This approach would allow you to sync properties with specific document versions when users roll back changes.
hey nova56, from what i know, doc properties aren’t included in version history. they’re separate from doc content. so if u rollback, properties will stay as is. maybe u could save important info in doc itself or use separate storage for version-specific data. hope this helps!
As someone who’s been developing Google Workspace add-ons for a while now, I can confirm that document properties aren’t part of the version history. It’s a bit of a pain point when you need to track changes in both content and metadata.
For your add-on, you might want to consider creating a custom versioning system. What I’ve done in the past is to store a JSON string in the document content itself, usually in a hidden paragraph at the end of the document. This JSON can contain all the property data you need to track.
When a user creates a new version, you can update this JSON with the current properties. Then, when rolling back, you can parse the JSON from that version and restore the properties accordingly. It’s not perfect, but it’s worked well for my projects. Just remember to handle potential parsing errors and edge cases.