Google Forms - Mapping output to something useable

The Scenario Setup

What I have tried:

I’m looking to get the Google data into something that can be uploaded into a Notion Database ( I have all that working ). The issue is that the Collections are not mapping into Notion as you can only select the 1st value.

This is only outputting the first value in the collection like the below:

image

The Goal

My guess is to turn the Google Form output into something useful from what it is at the moment:

image

    "answers": {
            "320744c8": {
                "questionId": "320744c8",
                "textAnswers": {
                    "answers": [
                        {
                            "value": "Goldfields"
                        },
                        {
                            "value": "Laurimar"
                        },
                        {
                            "value": "Mernda"
                        }
                    ]
                }
            },

and turn it into something like below:

    "answers": {
            "320744c8": {
                    "answers": [ "Goldfields", "Laurimar", "Mernda" ]
            },
    }

Module configurations and outputs

Update a Database Item

Error:

The operation failed with an error. [400] body failed validation. Fix one: body.properties.Languages.multi_select[0].id should be defined, instead was `undefined`. body.properties.Languages.multi_select[0].name should be a string, instead was `{"value":"English"}`.

Google Forms Output

[
    {
        "responseId": "ACYDBNjw4Cw8yyeKmXma1A52FpQtLigCmeTOgyEWgmqa8lFrToO_Wd_uR73tOZ1f1dnYP1Y",
        "createTime": "2023-10-19T04:17:39.283Z",
        "answers": {
            "320744c8": {
                "questionId": "320744c8",
                "textAnswers": {
                    "answers": [
                        {
                            "value": "Dietician appointments"
                        },
                        {
                            "value": "Ear things"
                        },
                        {
                            "value": "Flu"
                        },
                        {
                            "value": "Thing var"
                        },
                        {
                            "value": "Paediatrician appointments"
                        },
                        {
                            "value": " care"
                        },
                        {
                            "value": "Psychology appointments"
                        }
                    ]
                }
            },
            "3f7b522a": {
                "questionId": "3f7b522a",
                "textAnswers": {
                    "answers": [
                        {
                            "value": "Goldfields"
                        },
                        {
                            "value": "Laurimar"
                        },
                        {
                            "value": "Mernda"
                        }
                    ]
                }
            },
            "3475da33": {
                "questionId": "3475da33",
                "textAnswers": {
                    "answers": [
                        {
                            "value": "insta"
                        }
                    ]
                }
            },
            "458e9ec2": {
                "questionId": "458e9ec2",
                "textAnswers": {
                    "answers": [
                        {
                            "value": "Cosmetic Medicine"
                        },
                        {
                            "value": "Dietician"
                        },
                        {
                            "value": "General Practice"
                        }
                    ]
                }
            },
            "3e555b2b": {
                "questionId": "3e555b2b",
                "textAnswers": {
                    "answers": [
                        {
                            "value": "me@email.com"
                        }
                    ]
                }
            },
            "2106e798": {
                "questionId": "2106e798",
                "textAnswers": {
                    "answers": [
                        {
                            "value": "English"
                        },
                        {
                            "value": "Mandarin"
                        }
                    ]
                }
            },
            "399cc19e": {
                "questionId": "399cc19e",
                "textAnswers": {
                    "answers": [
                        {
                            "value": "link"
                        }
                    ]
                }
            },
            "41e6d7aa": {
                "questionId": "41e6d7aa",
                "textAnswers": {
                    "answers": [
                        {
                            "value": "Team health"
                        },
                        {
                            "value": "Aviation Medicals"
                        },
                        {
                            "value": "Anti-wrinkle injections"
                        },
                        {
                            "value": "cats, things, mine"
                        }
                    ]
                }
            },
            "3c95ed12": {
                "questionId": "3c95ed12",
                "textAnswers": {
                    "answers": [
                        {
                            "value": "I have professional social media"
                        }
                    ]
                }
            },
            "659f3c5e": {
                "questionId": "659f3c5e",
                "textAnswers": {
                    "answers": [
                        {
                            "value": "James Smith"
                        }
                    ]
                }
            },
            "76d0b609": {
                "questionId": "76d0b609",
                "fileUploadAnswers": {
                    "answers": [
                        {
                            "fileId": "1MeE8p_oimrR73gPh1EGhfcE4uZ2",
                            "fileName": "doctor_small -Kris.png",
                            "mimeType": "image/png"
                        }
                    ]
                }
            },
            "61b15211": {
                "questionId": "61b15211",
                "textAnswers": {
                    "answers": [
                        {
                            "value": "www.example.com"
                        }
                    ]
                }
            },
            "6f918240": {
                "questionId": "6f918240",
                "textAnswers": {
                    "answers": [
                        {
                            "value": "MBBS"
                        }
                    ]
                }
            },
            "3c19cfd0": {
                "questionId": "3c19cfd0",
                "textAnswers": {
                    "answers": [
                        {
                            "value": "facie"
                        }
                    ]
                }
            },
            "5f538fb3": {
                "questionId": "5f538fb3",
                "textAnswers": {
                    "answers": [
                        {
                            "value": "The serene landscape stretched before us,  in the warm hues of the setting sun. A gentle breeze rustled the leaves of ancient trees, creating a soothing melody. We strolled along a meandering path, lost in conversation. Laughter filled the air as we shared stories of adventure and dreams. The world seemed to slow down in that idyllic moment, offering a glimpse of timeless . As day turned into night, we  at the beauty of the universe, our hearts full of gratitude forfe."
                        }
                    ]
                }
            },
            "778b574a": {
                "questionId": "778b574a",
                "textAnswers": {
                    "answers": [
                        {
                            "value": "Dr."
                        }
                    ]
                }
            }
        },
        "lastSubmittedTime": "2023-10-19T07:56:11.685Z"
    }
]

Hi @Dev_Ops ,

Welcome to the Make community!

You need the map() function to turn a complex array into a simple array. You could then iterate the output from that, or just convert it to text and pop it into Notion.

image

In the above screenshot, the word “value” is telling the function to extract what you have in each “value” field of your “answers” array. The comma (,) is then used to sperate each of these values when converting them to text.

Pop this in the “Clinic Sites” field, and replace the mapping to “16.array” to your answers array.

2 Likes

Thanks, @Terry_Hopper for your help, I really appreciate it.

Just to tie this off for the knowledgebase, and those who get here from Google, rundown on the fixes from Google Forms => Update Notion Database Item.

This Tread gives a pretty good walkthrough of what works from the Notion side, thanks @Simo .

The Fix

There does not seem to be a need to change the data coming out from the Google Form, only in how it is mapped into the “Update A Database Item” individual fields, I wasted a fair bit of time playing around with the Tools, Iterator and Array aggregator.

Notion & Multi-select

As in @Simo answer, there is no need for the join for Notion Multi-Select fields, so below will get you there.

{{map(*foo_array*; "value")}}

image

Notion & Rich Text Field

@Terry_Hopper answer will get you across the line for Rich Text fields.

{{join(map(*foo_array*; "value");, )}}

image

Hope this helps, this is a great platform, just needs more info for newbies like myself, and it would be great if we all came back and uploaded the solutions not just run off with the answers.

Cheers
Matoni

2 Likes

Hello @Dev_Ops :wave:

Congratulations on solving this puzzle with assistance from @Terry_Hopper! :jigsaw:

Thanks a lot for remembering to share your insights with us and marking them as a solution. This way our community stays tidy, neat, and easy to look for solutions. :broom:

Keep up the great work!

1 Like