Splitting data in a collection/array

Let me preface this with I am very new here and this might be an elementary question

I am looking to take this data from a webhook export and put it into Google Sheets to make a dashboard

I have spent hours trying to figure out how to split up this data so I can enter into Google Sheets. Every time I go to the Google Sheets module it will only give me one of the metrics as an option

Screenshot 2024-06-17 at 8.45.46 PM
Screenshot 2024-06-17 at 8.45.35 PM

Welcome to the Make community!

You’ll need to use the map and get functions to map values within an array.

For more information, see Mapping with Arrays below:

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

General

Help Center Basics

Articles & Videos

samliew – request private consultation

Join the unofficial Make Discord server to chat with other makers!

1 Like

I tried mapping this and asking a friend who uses make and we are both stumped. The data is being nested as a collection and it doesn’t let me parse the test or extract any values

Could you provide a sample full output bundle as shown in your screenshots? This will allow others to help you further.

1. Screenshots of module fields and filters

Please share screenshots of relevant module fields and filters in question? It would really help other community members to see what you’re looking at.

You can upload images here using the Upload icon in the text editor:

2. Scenario blueprint

Please export the scenario blueprint file to allow others to view the mappings and settings. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.


(Note: Exporting your scenario will not include private information or keys to your connections)

Uploading it here will look like this:

blueprint.json (12.3 KB)

3. And most importantly, Input/Output bundles

Please provide the input and output bundles of the trigger/iterator/aggregator modules by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.

A.

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

Uploading them here will look like this:

module-1-output-bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:

Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

Following these steps will allow others to assist you here. Thanks!

samliew – request private consultation

Join the Make Fans Discord server to chat with other makers!

1 Like

This is the text of the data that shows up but in the next 2 screenshots you’ll see I have no way to gather that data. It will keep showing up as “data” and then switching between one of the 3 metrics I am trying to pull in

{
“data”: {
“metrics”: [
{
“data”: [
{
“qty”: 231.3304761904762,
“date”: “2024-06-20 00:00:00 -0400”,
“source”: “MacrosFirst”
},
{
“date”: “2024-06-21 00:00:00 -0400”,
“qty”: 289.82608695652175,
“source”: “MacrosFirst”
},
{
“source”: “MacrosFirst”,
“qty”: 78,
“date”: “2024-06-22 00:00:00 -0400”
},
{
“date”: “2024-06-24 00:00:00 -0400”,
“source”: “MacrosFirst”,
“qty”: 169.31293595263725
}
],
“units”: “g”,
“name”: “carbohydrates”
},
{
“units”: “g”,
“name”: “protein”,
“data”: [
{
“date”: “2024-06-20 00:00:00 -0400”,
“qty”: 132.2357142857143,
“source”: “MacrosFirst”
},
{
“qty”: 106.17391304347827,
“source”: “MacrosFirst”,
“date”: “2024-06-21 00:00:00 -0400”
},
{
“qty”: 56,
“source”: “MacrosFirst”,
“date”: “2024-06-22 00:00:00 -0400”
},
{
“qty”: 185.9289451022605,
“date”: “2024-06-24 00:00:00 -0400”,
“source”: “MacrosFirst”
}
]
},
{
“data”: [
{
“date”: “2024-06-20 00:00:00 -0400”,
“qty”: 52.56380952380952,
“source”: “MacrosFirst”
},
{
“qty”: 79.21739130434783,
“date”: “2024-06-21 00:00:00 -0400”,
“source”: “MacrosFirst”
},
{
“date”: “2024-06-22 00:00:00 -0400”,
“source”: “MacrosFirst”,
“qty”: 8
},
{
“source”: “MacrosFirst”,
“date”: “2024-06-24 00:00:00 -0400”,
“qty”: 56.82576157158235
}
],
“units”: “g”,
“name”: “total_fat”
}
]
}
}

Can you briefly describe how you want the output / final data to look like? I don’t think you’ve covered that yet.

Or could you break down the steps what you are trying to achieve?

E.g.:

  1. I would like to loop through each day
  2. I would like to get the metrics (carbohydrates, protein, total_fat) for the day
  3. I would like to insert the days’ metrics into a new row of the spreadsheet

Also, you did not provide #1 and #2 in my previous post.

samliew – request private consultation

Join the Make Fans Discord server to chat with other makers!

1 Like

Hi @Mike_Hughes
You can use the iterator module to loop through all the arrays and map the values to the Google Sheet. If you specify which values you want to map to the Google Sheet, we can provide further assistance.

If you require additional assistance, please don’t hesitate to reach out to us.
MSquare Support| Book Live Implementation
Visit us here
Youtube Channel

Im sorry im really frustrated and getting my thoughts out isn’t the best. Ideally I can have this webhook run each day to map peoples data to a google sheet which I then have flow into a dashboard and eventually an app

No problem, I’m here to help.

Perhaps a good first step is to create an example spreadsheet of how you want to structure your data, so we can advise how to map/insert your data into there.

samliew – request private consultation

Join the Make Fans Discord server to chat with other makers!

1 Like

Im just looking to map the data in its most simple form. ust a simple column for date, protein, fats and carbs. Once I get the data into google sheets I am good to manipulate it how I need.
Screenshot 2024-06-27 092726

Welcome to the Make community!

Yes, that is possible. You’ll need a minimum of two modules:

Screenshot_2024-06-27_210640

1. Iterate any metric’s data array

Screenshot_2024-06-27_210636

2. Use map and get functions to map each date’s data

Give it a go and let us know if you have any issues!

Output

Screenshot_2024-06-27_210656

samliew – request private consultation

Join the Make Fans Discord server to chat with other makers!

1 Like

Module Export

You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.

  1. Copy the JSON code below by clicking the copy button when you mouseover the top-right of the code block
    Screenshot_2024-01-17_200117

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the canvas.

  3. Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.

View Module Export Code

JSON

{
    "subflows": [
        {
            "flow": [
                {
                    "id": 5,
                    "module": "json:ParseJSON",
                    "version": 1,
                    "parameters": {
                        "type": ""
                    },
                    "mapper": {
                        "json": "{\n  \"data\": {\n    \"metrics\": [\n      {\n        \"data\": [\n          {\n            \"qty\": 231.3304761904762,\n            \"date\": \"2024-06-20 00:00:00 -0400\",\n            \"source\": \"MacrosFirst\"\n          },\n          {\n            \"date\": \"2024-06-21 00:00:00 -0400\",\n            \"qty\": 289.82608695652175,\n            \"source\": \"MacrosFirst\"\n          },\n          {\n            \"source\": \"MacrosFirst\",\n            \"qty\": 78,\n            \"date\": \"2024-06-22 00:00:00 -0400\"\n          },\n          {\n            \"date\": \"2024-06-24 00:00:00 -0400\",\n            \"source\": \"MacrosFirst\",\n            \"qty\": 169.31293595263725\n          }\n        ],\n        \"units\": \"g\",\n        \"name\": \"carbohydrates\"\n      },\n      {\n        \"units\": \"g\",\n        \"name\": \"protein\",\n        \"data\": [\n          {\n            \"date\": \"2024-06-20 00:00:00 -0400\",\n            \"qty\": 132.2357142857143,\n            \"source\": \"MacrosFirst\"\n          },\n          {\n            \"qty\": 106.17391304347827,\n            \"source\": \"MacrosFirst\",\n            \"date\": \"2024-06-21 00:00:00 -0400\"\n          },\n          {\n            \"qty\": 56,\n            \"source\": \"MacrosFirst\",\n            \"date\": \"2024-06-22 00:00:00 -0400\"\n          },\n          {\n            \"qty\": 185.9289451022605,\n            \"date\": \"2024-06-24 00:00:00 -0400\",\n            \"source\": \"MacrosFirst\"\n          }\n        ]\n      },\n      {\n        \"data\": [\n          {\n            \"date\": \"2024-06-20 00:00:00 -0400\",\n            \"qty\": 52.56380952380952,\n            \"source\": \"MacrosFirst\"\n          },\n          {\n            \"qty\": 79.21739130434783,\n            \"date\": \"2024-06-21 00:00:00 -0400\",\n            \"source\": \"MacrosFirst\"\n          },\n          {\n            \"date\": \"2024-06-22 00:00:00 -0400\",\n            \"source\": \"MacrosFirst\",\n            \"qty\": 8\n          },\n          {\n            \"source\": \"MacrosFirst\",\n            \"date\": \"2024-06-24 00:00:00 -0400\",\n            \"qty\": 56.82576157158235\n          }\n        ],\n        \"units\": \"g\",\n        \"name\": \"total_fat\"\n      }\n    ]\n  }\n}"
                    },
                    "metadata": {
                        "designer": {
                            "x": 1,
                            "y": -265
                        },
                        "restore": {
                            "parameters": {
                                "type": {
                                    "label": "Choose a data structure"
                                }
                            }
                        },
                        "parameters": [
                            {
                                "name": "type",
                                "type": "udt",
                                "label": "Data structure"
                            }
                        ],
                        "expect": [
                            {
                                "name": "json",
                                "type": "text",
                                "label": "JSON string",
                                "required": true
                            }
                        ]
                    }
                },
                {
                    "id": 28,
                    "module": "builtin:BasicFeeder",
                    "version": 1,
                    "parameters": {},
                    "mapper": {
                        "array": "{{5.data.metrics[].data}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": 245,
                            "y": -262,
                            "name": "Each Day"
                        },
                        "restore": {
                            "expect": {
                                "array": {
                                    "mode": "edit"
                                }
                            }
                        },
                        "expect": [
                            {
                                "name": "array",
                                "type": "array",
                                "label": "Array",
                                "mode": "edit",
                                "spec": []
                            }
                        ]
                    }
                },
                {
                    "id": 27,
                    "module": "google-sheets:addRow",
                    "version": 2,
                    "parameters": {
                        "__IMTCONN__": 95013
                    },
                    "mapper": {
                        "mode": "fromAll",
                        "insertUnformatted": false,
                        "valueInputOption": "USER_ENTERED",
                        "insertDataOption": "INSERT_ROWS",
                        "spreadsheetId": "1G4oYDWJLUT2KhsC4TbFp7Owh_dyG_-0NQOEk4gcMVNU",
                        "sheetId": "Sheet1",
                        "includesHeaders": true,
                        "values": {
                            "0": "{{28.date}}",
                            "1": "{{get(map(first(map(5.data.metrics; \"data\"; \"name\"; \"protein\")); \"qty\"); 28.`__IMTINDEX__`)}}",
                            "2": "{{get(map(first(map(5.data.metrics; \"data\"; \"name\"; \"total_fat\")); \"qty\"); 28.`__IMTINDEX__`)}}",
                            "3": "{{get(map(first(map(5.data.metrics; \"data\"; \"name\"; \"carbohydrates\")); \"qty\"); 28.`__IMTINDEX__`)}}"
                        }
                    },
                    "metadata": {
                        "designer": {
                            "x": 487,
                            "y": -263
                        },
                        "restore": {
                            "parameters": {
                                "__IMTCONN__": {
                                    "collapsed": true,
                                    "label": "Google Docs (samliew@gmail.com)",
                                    "data": {
                                        "scoped": "true",
                                        "connection": "google"
                                    }
                                }
                            },
                            "expect": {
                                "mode": {
                                    "label": "Select from all"
                                },
                                "insertUnformatted": {
                                    "mode": "chose"
                                },
                                "valueInputOption": {
                                    "mode": "chose",
                                    "label": "User entered"
                                },
                                "insertDataOption": {
                                    "mode": "chose",
                                    "label": "Insert rows"
                                },
                                "sheetId": {
                                    "mode": "chose",
                                    "label": "Sheet1"
                                },
                                "includesHeaders": {
                                    "nested": [
                                        {
                                            "name": "values",
                                            "label": "Values",
                                            "type": "collection",
                                            "spec": [
                                                {
                                                    "name": "0",
                                                    "label": "date (A)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "1",
                                                    "label": "protein (B)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "2",
                                                    "label": "fats (C)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "3",
                                                    "label": "carbs (D)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "4",
                                                    "label": "(E)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "5",
                                                    "label": "(F)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "6",
                                                    "label": "(G)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "7",
                                                    "label": "(H)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "8",
                                                    "label": "(I)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "9",
                                                    "label": "(J)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "10",
                                                    "label": "(K)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "11",
                                                    "label": "(L)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "12",
                                                    "label": "(M)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "13",
                                                    "label": "(N)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "14",
                                                    "label": "(O)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "15",
                                                    "label": "(P)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "16",
                                                    "label": "(Q)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "17",
                                                    "label": "(R)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "18",
                                                    "label": "(S)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "19",
                                                    "label": "(T)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "20",
                                                    "label": "(U)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "21",
                                                    "label": "(V)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "22",
                                                    "label": "(W)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "23",
                                                    "label": "(X)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "24",
                                                    "label": "(Y)",
                                                    "type": "text"
                                                },
                                                {
                                                    "name": "25",
                                                    "label": "(Z)",
                                                    "type": "text"
                                                }
                                            ]
                                        }
                                    ],
                                    "label": "Yes"
                                }
                            }
                        },
                        "parameters": [
                            {
                                "name": "__IMTCONN__",
                                "type": "account:google",
                                "label": "Connection",
                                "required": true
                            }
                        ],
                        "expect": [
                            {
                                "name": "mode",
                                "type": "select",
                                "label": "Choose a Method",
                                "required": true,
                                "validate": {
                                    "enum": [
                                        "select",
                                        "fromAll",
                                        "map"
                                    ]
                                }
                            },
                            {
                                "name": "insertUnformatted",
                                "type": "boolean",
                                "label": "Unformatted",
                                "required": true
                            },
                            {
                                "name": "valueInputOption",
                                "type": "select",
                                "label": "Value input option",
                                "validate": {
                                    "enum": [
                                        "USER_ENTERED",
                                        "RAW"
                                    ]
                                }
                            },
                            {
                                "name": "insertDataOption",
                                "type": "select",
                                "label": "Insert data option",
                                "validate": {
                                    "enum": [
                                        "INSERT_ROWS",
                                        "OVERWRITE"
                                    ]
                                }
                            },
                            {
                                "name": "spreadsheetId",
                                "type": "text",
                                "label": "Spreadsheet ID",
                                "required": true
                            },
                            {
                                "name": "sheetId",
                                "type": "select",
                                "label": "Sheet Name",
                                "required": true
                            },
                            {
                                "name": "includesHeaders",
                                "type": "select",
                                "label": "Table contains headers",
                                "required": true,
                                "validate": {
                                    "enum": [
                                        true,
                                        false
                                    ]
                                }
                            },
                            {
                                "name": "values",
                                "type": "collection",
                                "label": "Values",
                                "spec": [
                                    {
                                        "name": "0",
                                        "type": "text",
                                        "label": "date (A)"
                                    },
                                    {
                                        "name": "1",
                                        "type": "text",
                                        "label": "protein (B)"
                                    },
                                    {
                                        "name": "2",
                                        "type": "text",
                                        "label": "fats (C)"
                                    },
                                    {
                                        "name": "3",
                                        "type": "text",
                                        "label": "carbs (D)"
                                    },
                                    {
                                        "name": "4",
                                        "type": "text",
                                        "label": "(E)"
                                    },
                                    {
                                        "name": "5",
                                        "type": "text",
                                        "label": "(F)"
                                    },
                                    {
                                        "name": "6",
                                        "type": "text",
                                        "label": "(G)"
                                    },
                                    {
                                        "name": "7",
                                        "type": "text",
                                        "label": "(H)"
                                    },
                                    {
                                        "name": "8",
                                        "type": "text",
                                        "label": "(I)"
                                    },
                                    {
                                        "name": "9",
                                        "type": "text",
                                        "label": "(J)"
                                    },
                                    {
                                        "name": "10",
                                        "type": "text",
                                        "label": "(K)"
                                    },
                                    {
                                        "name": "11",
                                        "type": "text",
                                        "label": "(L)"
                                    },
                                    {
                                        "name": "12",
                                        "type": "text",
                                        "label": "(M)"
                                    },
                                    {
                                        "name": "13",
                                        "type": "text",
                                        "label": "(N)"
                                    },
                                    {
                                        "name": "14",
                                        "type": "text",
                                        "label": "(O)"
                                    },
                                    {
                                        "name": "15",
                                        "type": "text",
                                        "label": "(P)"
                                    },
                                    {
                                        "name": "16",
                                        "type": "text",
                                        "label": "(Q)"
                                    },
                                    {
                                        "name": "17",
                                        "type": "text",
                                        "label": "(R)"
                                    },
                                    {
                                        "name": "18",
                                        "type": "text",
                                        "label": "(S)"
                                    },
                                    {
                                        "name": "19",
                                        "type": "text",
                                        "label": "(T)"
                                    },
                                    {
                                        "name": "20",
                                        "type": "text",
                                        "label": "(U)"
                                    },
                                    {
                                        "name": "21",
                                        "type": "text",
                                        "label": "(V)"
                                    },
                                    {
                                        "name": "22",
                                        "type": "text",
                                        "label": "(W)"
                                    },
                                    {
                                        "name": "23",
                                        "type": "text",
                                        "label": "(X)"
                                    },
                                    {
                                        "name": "24",
                                        "type": "text",
                                        "label": "(Y)"
                                    },
                                    {
                                        "name": "25",
                                        "type": "text",
                                        "label": "(Z)"
                                    }
                                ]
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "metadata": {
        "version": 1
    }
}

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

General

Help Center Basics

Articles & Videos

samliew – request private consultation

Join the unofficial Make Discord server to chat with other makers!

1 Like