I’m working on a project where I need to detect if there are any suggestions present in a Google Document using only Google Apps Script. I came across some information mentioning that you can retrieve suggestions through API requests, but the examples I found were in Java and Python. I don’t need to edit or respond to these suggestions - I just want to check if they exist in the document. Is there a way to accomplish this task using Google Apps Script alone? I’ve been searching through the documentation but haven’t found a clear method for accessing suggestion data. Any help would be appreciated since I’m limited to using only GAS for this particular implementation.
Google Apps Script can’t access suggestion data through DocumentApp - you need the advanced Google Docs API, which isn’t available in standard GAS. I hit this same wall last year building a document review tool. My hacky workaround was exporting the doc as a Word file with DriveApp.getFileById().getBlob(), then comparing file sizes between the original and a clean copy. Suggestions usually make files bigger, so it gives you a rough idea if they’re there. Not pretty, but it works. For something more reliable, you’d have to use the REST API with UrlFetchApp to hit the Google Docs API directly, but that means setting up OAuth and getting way more complex than typical GAS stuff.
Hit this same wall building a document workflow system last month. Suggestions live in a separate layer that DocumentApp can’t touch at all. Found a couple workarounds though. You can catch revision history through DriveApp - won’t tell you about suggestions directly, but getLastUpdated() plus getEditors() shows when collaborative changes happened. Also tried the exportLinks property from Drive API. Documents with pending suggestions behave differently when exported. Grab the content using UrlFetchApp with the export URL and compare it to what DocumentApp gives you. If there’s a mismatch in length or formatting, suggestions are probably there. Not pretty, but it worked well enough for basic detection in my tests.
unfortunately, there’s no direct way in GAS to detect suggestions - the DocumentApp class just doesn’t expose that functionality. I tried this before and ended up using a completely different approach. You could try tracking doc revision history with DriveApp.getFileById().getRevisions() to see if there’s recent activity. not perfect, but it might give you some hints about collaborative editing happening.