1

I don't know how this functionality is called, but I think Word had it for years. Basically, I want to do something like this:

{Character1} just got out of his bed when he heard a loud noise outside.

Where every instance of "{Character1}" is replaced later with "John":

John just got out of his bed when he heard a loud noise outside.

No, I'm not looking for a simple search and replace function, I want to know if I could add commonly used words, like a name in a story for example, to some sort of database and refer to that in the text, so that if I ever end up changing the name of the character, it will automatically get replaced everywhere.

Is there a functionality like that in Google Docs? If not, how is it called in Word? I've been looking for it forever, I just don't know how to refer to it.

4 Answers 4

1

I have the perfect solution for you. The new Google doc add-on "Reversible Formulas" enables you to insert and evaluate formulas in your Google document.

It offers three ways to achieve what you are looking for.

Simpler way: No formulas needed

Write in your doc:

John just got out of his bed when he heard a loud noise outside

Select "John". On the side panel replace "x" by "Character1" and click on "Name Selection"

Now every time you want to reuse this name, click on the newly created button "Character1" that appeared on the side panel. You can rename your character using the input on the right of the button, or rename it anywhere in the text and click on "Display values" to synchronize all occurrences.

Programmer way: Declare names explicitely

Write in your doc:

Character1 = John
=Character1 just got out of his bed when he heard a loud noise outside

Now click on "Display values". The declaration stays, but the formula is replaced by "John". You can write anywhere in the document =Character1 and later click on "Display Values" to have it replaced by "John" (you could also do in in the previous approach :-)). And as before, you can rename the occurrences of John anywhere in the doc or in the side panel.

Expert way: Declare names implicitly

Write in your doc:

=Character1@("John") just got out of his bed when he heard a loud noise outside

Now click on "Display values". This is the equivalent of the "Name selection" button that you used in step 1, It's just that it inserted a formula with this syntax, so that it records the name of the value.

The add-on can be installed here: https://workspace.google.com/u/0/marketplace/app/spreadsheet_cells_in_javascript_fields_s/159836395898

Disclaimer: I'm the author of the add-on

7
  • 1
    According to recent comments (March 10,2020) in the G Suite Marketplace listing the add-on can't be installed. Mar 11, 2020 at 18:28
  • 1
    I'm working on it. On March 11th, Google sent me an email telling me I had too many users and the extension did not pass the verification exam, because it was named "Formulas for Google Docs", and Google's policy stipulates that it should not contain a reference to Google. I applied the required fixes the same day, including changes in the Policy, and resubmitted. I'm now waiting on their reply to grant access again. Mar 12, 2020 at 19:20
  • 1
    @Rubén As of today, March 16th, 2020, I tried and the add-on works again. I managed to comply to all branding guidelines of Google as well as the Privacy Policy. Mar 16, 2020 at 19:40
  • @MikaëlMayer As of January 1 2021 the add-on does not appear in the add-ons store, at least for me. It looks very useful. Is it still available?
    – InColorado
    Jan 2, 2021 at 5:34
  • It does, but the name has changed since. It's not "Reversible formulas", it's "Spreadsheet cells in JavaScript, Fields - Sketch-n-Script Jan 2, 2021 at 14:19
0

Google Docs doesn't include an equivalent feature to Microsoft Word fields, on the user interface the closest feature is the one that you don't want to use, find and replace.

Another alternative is to use Google Apps Script or a Google Doc add-on, if one that does what you are looking for exists and is updated as required by Google (changes to the way that authorization are handled, and soon, published to the G Suite Marketplace instead of the Chrome Web Store).

References

0

You can try docutemplate.com it is exactly though for this use case.

You just add ${variable} and then you can fill an HTML form in the application to substitute all the variables with the values that you input in the HTML form.

1
-1

For Microsoft Word, you can do it using fields. Before you can insert fields, you need to create them. Let's say we want to create a field called "Character". If you have Word 2007, 2010, 2013 or 2016, go to "File", "Info", "Properties" and then "Advanced Properties":

Find document properties

Switch to the "Custom" tab and type "Character" in the "Name" field. Then in "Value" field type "John" (or whatever name you want to use). Then click the "Add" button. Note that the "Add" button will not activate until you have inserted some text in the "Value" field:

Create field

Then click "Ok" and return to the document.

Now put your cursor where you want to insert the field:

Position cursor before insert field

Select "Insert" menu and from there "Quick Parts" then "Insert Field":

Insert Field

Select "DocProperty" from the list of field names and then select "Character" from the properties list:

Select character

Then click ok.

If you want to see all fields used in a document, press "CTRL+A" (i.e. select all). The field values will be highlighted in grey. I have added some more text to illustrate:

find fields

Now if you want to change the character name, you can go back to the "Advanced Properties" menu, change it there, then press "CTRL+A", right-click and select "Update Fields":

Update fields

In the pic below, I have updated it to "Adam":

Adam

2
  • 2
    I mean... thanks I guess, but that doesn't really answer my question. At least I know how it's called in Word, but I need it for Google Drive/Docs.
    – user162832
    Dec 22, 2018 at 18:39
  • This functionality does not exist in Google Docs beyond the most basic find and replace functions.
    – user205834
    Feb 14, 2019 at 17:32

Your Answer

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