Handling Empty CSV Files in Scenarios: A Guide for Automation
Have you ever encountered a situation where your scenario retrieves an attached CSV file from an Outlook message, but in some cases, the attached file only contains a single header row with no data? And when your scenario encounters this, it ends successfully and doesn’t throw an error. You need to continue the scenario a few more modules to finish the scenario which includes categorizing the original email to indicate it has been processed. But how do you force the scenario to continue if it isn’t generating an error?
Step-by-step Solution
The ideal way is to split the scenario into two routes - The first one will process the CSV, get results, and store the status in a Set Variable module. Then, get the output in the other route using the Get Variable module.
Here's how you can do it:
- Put a “Text parser: Match pattern” module before a router.
- For Pattern, put in there. This matches a newline so you know there is more than just the header row in the data. Important: Select “Continue the execution of the route even if the module finds no matches”.
- For filters, output “Value” or “Fallback Match” of “Text parser: Match pattern” module exists.
- Fallback route if no newline found.
Troubleshooting Tips
If you're on a plan that doesn't let you use variables, you might have to duplicate modules on the two routes. Also, you don't need a commit module, that's for error handling.
If you only want to update the original email once to indicate it has been processed, make sure either routes from the router has an “Update a Message” module, so in any case Email will get updated. If you don’t want to update email on the fallback route, just delete the bottom path (you can keep the router).
Summary
In conclusion, handling scenarios with empty CSV files can be tricky, but with the right steps and modules, you can easily navigate through this challenge. Remember to split your scenario into two routes, use the “Text parser: Match pattern” module before a router, and set the right filters. Happy automating!
You do have further questions?
Ask your question via E-Mail: Richard@make-app.de
Book a paid Support & Consulting Session
New Make.com user? Sign up through this Affiliate Link to receive 10.000 operations for FREE.