5

Is there a way to easily export comments (and ideally, status, context, author, date, etc) from a Google Docs file into a spreadsheet, without scripting/coding?

I'm sure there are programmatic ways to do something like this, but I was hoping there was some built-in function, lesser-known-feature or potentially a feature of another add-on I can just install.

I tried already to export the document into a different format, but none were what I was looking for. Also searched the Workspace Marketplace for an add-on but none seemed to do the trick. I didn't find any add-ons at first glance, but I could have missed it.

1 Answer 1

2

After reviewing all the options I could find, I would say there really isn't what I would call a good way to do exactly what's described in the question.

Full answer 1: Use a Google Workspace extension

As covered in an answer by OP elsewhere on this site, Comments Exporter will apparently do this. Unfortunately, there doesn't seem to be a way to preview the code of this extension before (or even after) installing, so good luck if you wanted to check if it was malicious.

Full answer 2: Use Google Apps Script

I was able to get this code by tatertank to work, though it only shows some comments (I think only the first in a thread, no suggestions, and no resolved messages). Replace the two placeholder IDs and make sure you have a "Comments" sheet. Before running the code, you'll need to add the Service "Drive API". You also need to call the proper function, which can be done by putting listComments(); before the last }.

Partial answer 1: Export comments without any formatting

You can see only the comments by clicking on the comment history button in the top right:

icon looks like a speech bubble with lines

From there, selecting the comments and copying the text like that gives you something that you can paste. For example, USER1 left a comment with the text "A long monologue" on the text "something" (and "ME" is there only because I can add a comment underneath).

Selected text
|
something
USER1
USER1
Dec 23, 2021
A long monologue
ME

This is acceptable (but not great) if you're pasting into another Google Doc; you could even paste with the formatting, which includes color-coding. Unfortunately, while you can paste this into a Sheet, it will all be in the same column, which probably isn't what you wanted. Parsing these comments into a more useful format is not trivial since they can be threaded and not all of them have "Selected text" (I think when it's an edit suggestion) and there may be newlines in unexpected places.

In my case, I was able to create a regex that happens to work on this weird format for the most part ((.*)\n.*\n(.*)\n(^... \d+, 20\d{2}$)\n(.*)), but it's very fragile for the reasons I mentioned above (it relies on American-formatted date-stamps too). You have to export the matches (excluding the full match) from that and run a regex replace with a second regex (matching (.*)\n(.*)\n(.*)\n(.*)\n? and substituting $1\t$2\t$3\t$4\n) to get something formatted for a sheet.

Not great, but I spent too much time on it to throw it away.

Partial answer 2: Top level open comment text only

If you save as HTML, the comment text from all open comments (but not comment replies) will be at the bottom. (This is the same as what you see when you open up the doc on a mobile browser.) You can easily copy this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.