Using Pick from list
The Pick from list function can be accessed by choosing the Formatter app > Click "Utilities" > Choose "Pick from list" under Transform.
The Pick from list Text function lets you choose from a given list depending on the option you choose. The operations you can choose from are:
- Choose First
- Choose Last
So let's say you have a list of animals:
If you select the operation "Choose First," the Formatter would give you the output "Dog.
If you select the operation "Choose Last," the Formatter would give you the output "Turtle.
If you select the operation "Random," this would give you a random selection from the list. In this example, it gave us "Turtle", "Cat" and then "Fish"
You can also select the "Use a Custom Value" option to use an option other than first, last, or random, and enter a number in the "Custom Value for Operation" field. Keep in mind that the counting will begin at 0, though, so a custom value of 0 will return the first item in the list, a custom value of 1 will return the second item in the list, and so on. For example, if I select "Use a Custom Value" and use a "Custom Value for Operation" input of 2, the step will always return "Mouse", the third item in the list:
Using the Lookup Table
The "Lookup Table" function is handy if you need to pass on one of a few various fields. For example if your Trigger app only passes on a name but your Action app needs an ID. You can create a list of records your Trigger can search for and then pass on the correct value.
To get started create a Formatter action and choose Utilities and then "Lookup table" under Transform.
In the "Lookup Key" field you will want to pass on the trigger field you want to search your table for like this:
Using the "Lookup Table" section you will want to add each of the possible items you want to search for. The box on the left is the value you will search by and the box on the right is what will be returned with your Action. Keys are case-sensitive.
You can add more fields here by using the + icon like this:
Finally, you can optionally set a "Fallback Value". This will be returned if your search yields no results. This is an optional field.
When your Zap runs it will pull in your search result. In the example below, my Trigger app sent on "Micah" so my search result pulled in "ZAP23456Z":
You can then pass that on to your Action app's template like this:
Have a very large list, one that needs to be edited regularly, a list of exported data, or referenced by multiple steps/zaps? Consider instead using a Google Sheet to create a 2 column list, one with the source value and one with the destination value and reference it using the "Lookup Spreadsheet Row" search in the same way outlined above.
Using Default Value
One super handy way to use the Default Value option is to create a fallback for fields that may not always be provided in your Trigger step.
Let’s say you have a web form that asks for user information and the Company field is optional, but your Action step requires that you add a company in order to create a lead.
Here’s how you could use Default Value to ensure that you use the company name when it’s available, but otherwise use “Not Available”.
Now on the step that has Company as required, you use the output of that Default Value step. If a value was present in the field you checked (Company), that will be used. If the field was empty, then the output will be what you used in the Default Value step.
Using Split Text
Using Split Text to Separate Text Input Into Parts
This is especially useful when a Trigger app provides a name in a Full Name field, but your Action app needs a First Name and Last Name.
The Split function can be accessed by choosing the Formatter app, clicking “Text”, and choosing “Split” from the Transform dropdown.
This function lets you input a line or block of text and break it apart at certain a character or phrase. You can then choose which segment of the text you’d like to output.
If you need to isolate just the first name from a “Full Name”-type piece of data, for example, you can map the “Full Name” data to the “Input” field.
You would then type the text you’d like to split on—in this case, a space—in the “Separator” field.
Certain special characters need to be specified using special syntax.
Finally, you would complete setup of this step by choosing which segment of the split text you'd like. In this case, where you want just the first name, you’d choose “First”.
Once this is set up, if your Zap triggers and the input field contains a full name like “Jane Smith”, the Formatter will return just “Jane”.
Then, to insert that first name in another app you would do the following:
If the app to which you're sending data requires a last name, you can repeat the steps above except instead of choosing "First" in the Segment Index you'd choose "Last".
→ Learn more from the Zapier Blog: How to Split Names and Other Text with Formatter.
Using Split Text to Extract Data
There are times when you may need to extract a small portion of data from a larger set of info. For example, you receive notification emails when someone buys a product from you, and within the email you need to get the SKU number.
For the Trigger, use whichever app contains the data. In this case it’s Gmail. Notice that the SKU number is buried amongst other data.
The first step is to use Split Text to extract everything after the word SKU. In the Input field, add the source of your data. In our example it’s the Body Plain from Gmail. As the separator we’ll use the word “SKU” followed by a colon and a space (this means our output won’t have a space before it). We’ll keep the second segment.
Now we’ve got the SKU number but also that additional paragraph.
Let’s isolate the SKU number by using the output of our first Split Text step, and keeping the first segment. As a separator, we’ll use
[:Newline:] which will take everything before that blank line between the SKU and the paragraph.
Now we’ve got the SKU number as its own piece of data, to use in other steps.
The final — and probably most important — step is to use that extracted data in our next Action step. You must make sure to use the output of our last Split Text step and not the original data from the Trigger.
→ Learn more from the Zapier Blog: How to Extract Phone Numbers, Email Addresses, and Links with Formatter.
There are many ways to use the Replace option, but here’s an example of how to change a comma-separated list of items and put them on their own individual line instead.
Let’s say you wanted to get the tags from an Instagram photo and place them on their own line of an email you want to send.
Looking at the test step of the email step, here’s how it would appear by default.
Let’s fix that. Here we specify the Input as the tags from Instagram. For the Find field we use the comma. The Replace field is optional, and if you leave it empty you will replace the comma with nothing, in essence just removing it. But in this case we use
[:Newline:] to drop each tag onto its own line.
Using the output of our Replace step, we now see that the commas have been removed and each tag occupies a line of its own.
→ Learn more from the Zapier blog: How to Find and Replace Text with Formatter.
Converting a datetime value to a UNIX/Epoch timestamp
The UNIX timestamp is a format for representing a date/time as the number of seconds that have elapsed since January 1, 1970. For example,
1493422281 is the UNIX time for
28 April, 2017 23:31:21 GMT.
You can use a Formatter take a datetime in different format (like
2017-04-06T12:15Z) and convert it to a UNIX timestamp.
Let’s say you need to enter a UNIX timestamp in a Hubspot field (we'll call it "Contact Birthday"):
- Add a step to your Zap before the Hubspot action
- Choose Formatter by ZapierDate/TimeFormat
- Set it up like this—insert the datetime field you need to convert in the Input field:
- Then, in the Hubspot step (or whatever action step you're using), insert the output from the Formatter step in the "Contact Birthday" field
If you need to convert a UNIX timestamp to another date format, just switch what you put for the "From Format" and "To Format" fields in the Formatter step!
→ Learn more from the Zapier blog: How to Format Dates and Times with Formatter.
Converting Markdown text to HTML or PDF
Want to write in Markdown, then use the formatted text in other apps—perhaps in WordPress to publish a blog post, or with Google Cloud Print to save a formatted PDF or print out your document? Formatter can convert your text for you. Here's how:
- Add a step to your Zap before the action where you want to use your text
- Choose Formatter by ZapierTextConvert Markdown to HTML
- Add your Markdown formatted text in the Input field
- Then add another step to use your text, using the output from the Formatter step in the field where you want formatted text. If you want to make a PDF file, use Google Cloud Print as the following action, and choose to save your file to Google Drive to get a PDF instead of printing out the document.
→ Learn more from the Zapier blog: How to Convert Markdown Text with Formatter.