user3159388
user3159388

Reputation: 41

How to programmatically list the suggested edits in a Google Doc

When listing the comments in a Google Doc file, using the comments.list API method, the returned list only contains "regular comments", and does not contain "suggested edits", i.e. the suggestions that users can make when the document is edited in "suggesting" mode.

Is there any way to programmatically enumerate the suggested edits, and is there a way to programmatically accept them?

Upvotes: 2

Views: 492

Answers (2)

bodily11
bodily11

Reputation: 604

Unfortunately (yes, in 2020), this is still not possible via the API. It is possible to see what the suggested edit is (added or removed text, changed style, etc.) from the API, but you can't see who made the edit or when they made the edit.

The work around I am currently using is (does not work retroactively):

  1. Subscribe to Google Doc changes via email (Gmail specifically)
  2. Use the Gmail API to get all emails received from [email protected]
  3. Parse the email contents to get comments AND suggestions, including when, who, and what
  4. Now that you have the suggestions and comments, you can do whatever you want with it. Save it to Google spreadsheet, save it to .csv, etc.

This answers the first part of your question: programmatically enumerating them. As for programmatically accepting them, currently not possible through the API. I haven't done it, but I believe it is possible to do it via JavaScript.

Upvotes: 1

KENdi
KENdi

Reputation: 7771

I think as of now, you can not get it programmatically. If you check the Google Drive documentation, you will not find any documentation about suggested edits. Also, this SO question prove it that Suggested edits is not yet accessible via API.

The question here is

Can I include "Suggested Edits" from my Google Document alongside the comments. Can those be accessed via API yet?

And the answer by Mogsdad is NO.

So what can I recommend to you is file a feature request about this issue :)

Upvotes: 1

Related Questions