I’m trying to simplify our company’s business card design process using Google Sheets, Google Presentation, and Zapier. My template includes fields for name, job title, address, and contact info. I’ve set up a script in Zapier to handle optional cell and fax numbers, but I’m having trouble with empty fields.
Here’s my problem: When both cell and fax are empty, the template still shows {{Print Cell/Fax}} instead of leaving it blank. For example:
John Doe
Janitor
International Space Station
555 S. Milkyway St.
Saturn, Vermont 11122
555-259-5555{{Print Cell/Fax}}
[email protected]
How can I make sure the {{Print Cell/Fax}} placeholder disappears when there’s no data? I want it to look clean like this:
John Doe
Janitor
International Space Station
555 S. Milkyway St.
Saturn, Vermont 11122
555-259-5555
[email protected]
Any ideas on how to fix this in my automation setup? Thanks for your help!
I encountered a similar issue with business cards and empty placeholders. I solved it by using conditionals in my spreadsheet before the Zapier step. For instance, I set up a formula like:
This formula checks if both fields are empty and returns an empty string, removing any unwanted placeholder text in your output. Adjusting your Zapier workflow to pull the calculated field instead of the raw data should give you the cleaner result you’re aiming for.
Have you considered using a more robust template system? I’ve had success with Jinja2 for similar tasks. It allows for easy conditional rendering, which could solve your placeholder issue.
In your Google Sheets setup, you could create a combined cell/fax field with a formula that only populates if there’s data. Then in your template, use Jinja2 syntax like {% if cell_fax %}{{cell_fax}}{% endif %}. This way, if the field is empty, nothing will be rendered.
Alternatively, if you’re set on using Zapier, you might need to add an intermediate step that processes the data before it reaches your final template. This could involve using Zapier’s Formatter or Code by Zapier to clean up empty fields.
Remember, the key is to handle the logic before it reaches your final output stage. This approach should give you the clean result you’re after.
hey, have u tried using a custom formatter in zapier? it can help remove those pesky placeholders. just create a step that checks if the cell/fax fields are empty and only passes them along if they have data. that way, ur template won’t show anything when there’s no info. hope this helps!