Can a Google Docs content be deleted/cleared?

Someone already asked for help but the reply was not heklpful:

[How to delete the content in a google doc - How To - Make Community]

It should be simple enough in theory, to delete a doc’s content :thinking:

In theory… In practice, it’s more complicated.

The Make.com module isn’t built for that from what I can tell. If you want to delete text in a document, you have to use an API call.

It’s all explained in gory details here:

L

P.S.: I don’t know why the preview is in French.

Welcome to the Make community!

Yes, that is possible. You’ll need a minimum of two modules:

Screenshot_20240822_150654

The first module is used to get the ranges of the document content.

This is just an example. Your final solution may or may not look like this depending on your requirements.

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!

1 Like

@samliew

Would you be able to provide more details on “Make an API Call” module?

Thanks Sam and Henry,

unfortunately this seems to be another one of MAKE’s less documented features :grimacing:

I guess with "put"I could overwrite the content with a space or nothing. Problem is the atypical syntax the module is requesting. What’s up with that instead of just IDs?

I don’t know what to put for /v1/documents/{presentationID} so I couldn’t MAKE it work.

No, a PUT is incorrect. Google Docs API doesn’t support PUT method at all.

Here is the endpoint you need to use to update the document:

Then, find an appropriate “Request” to pass along in the batchUpdate call:

You could try the deleteContentRange request.

Hope this helps! Let me know if there are any further questions or issues.

@samliew


Did you know this forum has a Hire a Pro category, where you can post your request for off-site specialised help on other platforms (video call/screenshare/private messaging/etc.)? This may help you get your issue resolved faster especially if it is urgent. It is important to post your request in the Hire a Pro category, as forum members are not allowed to advertise their services elsewhere (like here).

Thanks Sam, but this is too hacky for my time :sweat_smile:

I’ll just create a new Doc everytime instead :sunglasses:

To wrap this workaround up:

  1. My scenario now starts with looking for the only Google Doc in a designated drive folder. There is only ever one in there - the one created during the last run.
  2. It will be moved to a subfolder (“Archive”) .
  3. The new doc gets created and filled with content.

This makes it fool proof to reference the doc later - not just through mapping but because - again - it’s the only file in that folder. :smiling_face:

image

3 Likes

HI @neomagic,

Nice solution, well done!

L

1 Like