Replacing Text In Google Doc

:bullseye: What is your goal?

I want to replace placeholder text in Google Doc with input from Fillout Form. The Google Doc has titles like {{Name}}, {{CustomerID}}, etc.

:thinking: What is the problem & what have you tried?

In the Google Docs replace text module, if I type those in to “old"text” they turn into black chips. What am I missing?

:clipboard: Error messages or input/output bundles

BundleValidationError
Validation failed for 4 parameter (s).
Missing value of required parameter 'oldText.
Missing value of required parameter 'oldText.
Missing value of required parameter 'oldText.
Missing value of required parameter 'oldText.

:camera_with_flash: Screenshots (scenario flow, module settings, errors)

Hello,

Welcome to the community @KBjorge.

You’re not missing anything – Make automatically converts {{}} into tokens.

So when you type {{oldText}}, Make immediately turns it into a token/chip because it assumes you’re referencing a function. Since that variable doesn’t exist, it’s empty – and the request to Google Docs ends up trying to replace an empty tag.

Two ways to solve it:

Option 1 – Use the replace function:

{{replace(replace("[[text1]]"; "[["; "{{"); "]]"; "}}")}}

This replaces [[ with {{ and ]] with }} at execution time, so Make never sees the curly braces while you’re building and doesn’t convert them to a token on UI level.

Option 2 – Ignore the token and type the Google Docs tag directly:

How does it work?
The token references a non-existing variable, so it will always be empty during processing – Make sends it as {{text1}} even if you see {{SOMETHINGyourTag}}.
You can also insert {{emptystring}} between {{ and text1}} to split the tag so Make doesn’t convert it automatically.

A couple of things to watch out for: with option 1, make sure you use placeholder characters that won’t appear anywhere in your actual Google Docs tags. With option 2, make sure the variable name you’re using doesn’t actually exist in your scenario.

Despite appearances, this situation comes up very, very rarely.

Have a nice day,
Michal