Concatenate and Format
Share
Explore

icon picker
Concatenate and Format

Your friends for powerful, customized text
Text is most useful when it is flexible, customizable, and deftly integrated with our data. Contcatenate() and Format() are the specific mechanisms that allow us to do so, and they can be pivotal in creating app-like behavior in our apps.
From simple statements that change with our data to sending 100’s of automatic emails with the push of a button, all individualized per recipient, Concatenate() and Format() provide you with immense control over your doc’s data.

Formulas: Concatenate() and Format()
Category: String
merge-vertical.svg
Concatenate()
Allows you to combine multiple values and output them as a single string of text
Using this formula is like saying...
Hey Coda, I want you to take some text and combine it with other data—perhaps some tables, numerical values, etc. Can you put them into one block of text for me?
align-center.svg
Format()
Allows you to combine multiple values and output an individualized block of information
Using this is akin to saying...
Hey Coda, here’s a template to follow. Now I’m going to provide you with some values, which can be text, numbers, etc. Can you format these values to the template I gave you?
Concatenate() takes one repeating parameter:
text-color.svg
Text

Concatenate(Text)

Add any text, including words, numbers, chips, etc. Different values separated by commas.

Format() uses two parameters:
template.svg
Template

Format(Template, Text)

The structure you want to input information into. Must include bracketed numbers in each place you want to input information.

EX: Format("{1} {2}, {3}.", Text)
text-color.svg
Text

Format(Template, Text)

The information you want to input into your formula. The bracketed numbers inside your template are the spots where your text will be placed. The text arguments are variable - you can have just 1 value {1} or as many as you like!

Do Concatenate() and Format() sound similar? Good, they should. Both formulas accomplish the same task—allow you to make rich and customizable text that can integrate canvas formulas, table info, and other information in your docs.
The difference between these formulas is twofold:
1) Each formula uses different mechanisms to achieve a similar result.
2) Format is technically more powerful, flexible, and user friendly...more on this later.

Concatenate()

To use this formula, insert the text you want as the value and use commas to separate different values. For example:
Let’s say we want to create a welcome statement for someone when they open a document. You could, in the canvas, write:

image.png

When written as a canvas formula, the output looks like this:
Hello Anonymous User, and welcome to The Coda School!
Notice how we used concatenate to to make it custom to whoever is looking at this doc? This formula made our document more flexible, and it added to the user experience.

Format()

To use this formula, create your template using bracketed numbers (i.e., “{1}, {2}”) in exactly the format you want your text to be. Then, separate each value you want to plug into each number with a comma.
Let’s take a look at this example:

Though I live in Texas where breakfast tacos reign, I still favor and very much miss my California breakfast burritos. If I want to keep tabs on the number of breakfast burritos I eat per month, I might build a slider to keep track.
00
0
@Anonymous User
has consumed 0 breakfast burritos this month.
Screen Shot 2022-11-26 at 8.56.42 PM.png

Going Deeper

Where Format() trumps Concatenate() is in its simplicity and flexibility. With concatenate, you can quickly get lost in the weeds with lengthy text or if you want to quickly alter the formula/text in the future.
For example, one area where Format() shows its strengths is in creating custom templates.
Below is an example of an email template we might send to new Coda School students. Go ahead and click into the card to adjust the text in the subject line and body. Watch how it automatically changes the “Email Output” column in the table below. Then, explore the formula in the “Email Output” column below and notice simplicity of the formula.



Welcome to the Coda School!


Name
Course Purchased
Date of Purchase
Email Output
1
Stuart Weir
Automations Course
8/20/2022
Hello Stuart Weir,
It is our pleasure to welcome you to this course.
Your purchase of the
Automations Course
on 8/20/2022 will certainly mark the beginning of your Coda success!
All the best,
The Coda School

2
Morgan Lott
Formula Course
8/23/2022
Hello Morgan Lott,
It is our pleasure to welcome you to this course.
Your purchase of the
Formula Course
on 8/23/2022 will certainly mark the beginning of your Coda success!
All the best,
The Coda School

There are no rows in this table

Extra Credit: Check out for a thorough look at this use case.


Done
Done
Done



Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.