Greetings!
I am handling registrations for an inter school symposium and I would like to know the best approach to update multiple google sheets based on the data that I receive from the form handler webhook.
The symposium has multiple events. Each of these events has a corresponding google sheet in a drive folder. When a school submits the registration form, I receive data of the students that participate in various events. I want to check this data and then route specific chunks of info to separate google sheets, based on the event. Basically, what I am trying to achieve here is event-wise response sheets.
The webhook data that I receive is of the following schema:
{
"body": {
"fields": [
{
"key": "question_some_id",
"type": "",
"value": ""
}
]
}
}
At the start of the form, I have a checkbox asking for the events the school is participating in. This checkbox has a type of CHECKBOX
(in the above structure) and value
is a boolean depending on whether the user has selected the particular checkbox or not. There are 20 checkboxes for the 20 events that we have, each checkbox has its own key
that identifies it in the above webhook response.
This is where I want to begin my filtering.
Each event name (or checkbox in the form) has also corresponding set of questions (like participant data) which is identified by their key
. I have the set of key
that correspond to each question (each event has 5-6 questions, each having their key). What I am aiming to achieve here is, to loop through the fields, check whatever checkbox the user has selected. Using the key
of this checkbox, identify what event it is, what further questions correspond to this event (from the set of questions that I have corresponding to this event), and what google sheet the data (which is basically just a string put together from multiple questions in the set, like name and further participant data) must go into.
After this data has been extracted, I will perform further text sanitization and formatting and update a google sheet row with this data.
I have previously looked into the switch
node, routing different values to different sheets, but I have been unsucessful in my tries. I wonder whether I should be using the Code
node?
Please put me in the right direction.
Information on your n8n setup
- n8n version: 1.100.1