2

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?

2 Answers2

1

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 :)

Community
  • 1
  • 1
KENdi
  • 7,576
  • 2
  • 16
  • 31
1

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 comments-noreply@docs.google.com
  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.

bodily11
  • 584
  • 6
  • 10
  • 1
    [This link](https://developers.google.com/docs/api/how-tos/suggestions) seems to suggest that it's possible with the API, but not in an easy manner - if I understand the summary you basically need to fetch the entire document content and then look through it for suggestions. – Michael Nov 11 '21 at 17:52
  • This is a real bummer. Would be really nice if there was just a metadata attribute like unresolved: boolean. I just want to flag documents with unresolved changes. Digesting the whole document to figure this out is very inelegant. – mattador Sep 16 '22 at 21:46