Using Conditions and Filters with Document Studio
Document Studio enables you to add one or more conditions to your workflow rules and thus the automation will only process rows of a sheet that match the specified criteria. Conditions are also applied to incoming Google Form submissions and a response is processed only when the user's answers match the specified conditions.
Here are some instances where conditions can be applied in workflows:
- If you have a Google Sheet with names of all the students of a class, you can choose to send an interview email invite to only those students who have GPA above 9.
- If your Google Form asks for the age of the submitter, you can choose to send a notification email to the parent if the age entered is less than 18.
- Any order placed online using Google Forms can be directed to the right department. For instance, if the customer orders a mobile phone, the electronics department can be notified. If a book is ordered, the department for books and stationery can be notified.
- If you are using Google Forms for tech support, you can send an escalation email to the manager if the customer has selected "high" for the severity level.
- You can use a Google form as a quiz, and only create certificates for the applicants who have obtained a full score.
- If you have a Google Sheet with names and email addresses of people who would like to attend a webinar on Zoom or Google Meet, you can send reminder emails based on the event date.
AND-OR Operator Blocksโ
Conditions in Document Studio are grouped into Blocks. The workflow will be processed only if ALL
conditions defined in at least one block are satisfied. If any one condition belonging to a particular block is not satisfied, the workflow doesn't run, and the conditions in the next block are checked against the sheet row.
For instance, in the screenshot below, there are two blocks. The first block has two conditions against the name and gender columns. If both these name and gender conditions are satisfied, the workflow will be processed else it will evaluate conditions in the second block and so on.
All conditions belonging to at least one block should be true for the workflow to run.
Multiple tasks can be added to each workflow, and ALL tasks within that workflow will be executed if the conditions are satisfied. To specify a different set of conditions for some tasks, please create another workflow with those tasks.
For Text Fieldsโ
Condition | Description | Example |
---|---|---|
Is Any of | Answer should be one of the specified list of values. Please specify the list of values by separating them with a comma or by pressing the Tab key after each value. | You can specify a condition for the workflow to run only if the answer field is any of United States, USA, US. The condition will be satisfied if the spreadsheet cell contains any one of these values. Similarly, the specified list for the month entered can be Jan, January. The workflow will run for rows that have either of these values. |
Is none of | Answers should not match any of the items specified in the list. | If the specified list is United Kingdom, UK, Great Britain, the condition will be satisfied for all rows except those that contain any of these values. |
Exists | The user's answer in the Google Form, or the cell value in the sheet, contains at least one character. | If the answer in the specified field contains any character, it will satisfy this condition. This will also match answers like 0 but blank value will not be matched. |
Does not Exist | The cell value in sheet or answer field in Google Form should be blank or non-existent. | If the answer in the specified field is left blank, it satisfies this condition. |
Exactly Matches | The answer is exactly the same as the specified text (case insensitive). | Netherlands will match both Netherlands and netherlands but it will not match Nether Lands or Nethrelands. Similarly, Jan would not match January but would match january. |
Does not exactly match | The answer should not be the same as the specified text. | If the condition specified is that the grade entered does not exactly match F, the workflow will run for all other grades except F. |
Contains | Text is anywhere inside the answer field (it can also be a substring of a word) | Czech would match Czechoslovakia as well as The Czech Republic. |
Does not Contain | Answer does not contain the specified text | This condition can be used if you want your workflow to run for only those rows that do not contain the specified text. |
Starts with | Answer that starts with the specified text or character | $ would match $50 and ยฃ would match ยฃ100. |
Does not start with | Answer should not start with the specified text or character | This condition can be used if you want your workflow to run for only those rows, the entries of which do not start with the specified text. |
Ends with | Answer ends with the specified text | Inc. would match all answers ending with Inc. If you have a list of employees from different companies, you can send an email to employees who work for specific companies by looking at their domains in email addresses. |
Does not end with | Answer does not end with the specified text | This condition can be used if you want your workflow to run for only those rows, the entries of which do not end with the specified text. For instance, if you set this as @nike.com, @google.com , it will process all records except where the email address is neither of these two values. |
For Numeric Fieldsโ
Condition | Description | Example |
---|---|---|
Greater than | Answer is greater than or equal to the specified number | If the recipients' age, calculated using the DATEDIF function with entered date of birth, is less than 18, an email can be sent to the parent's address. |
Less than | Answer is less than or equal to the number | In the list of students of different grades willing to go for a school trip, if the student's age is less than 18 (minor), consent forms can be sent to their parents to confirm that their children have permission to join in. |
Equal to | Answer matches the specified numerical value | You can use this condition for more specific cases, for instance, to make a certificate for students with a full score in a quiz made using Google Forms. |
Not equal to | Answer does not match the specified numerical value | If a student's score in a quiz is not equal to the maximum attainable score, they can be sent an email with their score and attached correct answers. |
Regular Expressions (RegEx)โ
These are for advanced users and some knowledge of regular expressions is essential.
Condition | Description | Example |
---|---|---|
Matches RegEx | The cell value or user's answer in the form satisfies the regular expression | ^\d{5,6}(?:[-\s]\d{4})?$ will match the zip code. |
Does not match RegEx | The cell value or user's answer in the form does not satisfy the regular expression | ^\d+$ will ensure that the input text does not contain all digits. |