Issue with Oura API Data Not Inserting into Google Sheets Properly

Hi everyone,

I’m having trouble with my Make.com scenario where I’m trying to retrieve data from the Oura API and insert it into a Google Sheets document. The flow is simple:

  1. Make an OAuth 2.0 request to the Oura API to get sleep data.

  2. Insert the received data into a Google Sheets spreadsheet.

In my first step, the Oura API request works perfectly (status code 200), and I can see the data is being returned correctly (see Screenshot 1 attached).

However, when I try to pass that data into Google Sheets, I receive a 422 error stating that there is an “invalid character in year” for the date 2024-09-16 (see Screenshot 2 attached).

I double-checked the format of the date, and it appears correct (YYYY-MM-DD). Also, there are no steps or operations between the API request and the Google Sheets block that could alter the data.

Does anyone have any idea why this might be happening? I’d appreciate any help or suggestions to resolve this issue. Thanks in advance!

Attachments:

• Screenshot 1: Successful Oura API response.

• Screenshot 1.5: more detail about Oura API response

• Screenshot 2: Error when trying to pass data into Google Sheets.

what is the data type of date that you are receiving from the API if its string or date?

I would like the data obtained from screenshot 1.5 to be written into the Google sheet.

IGNORE THIS REPLY my bad parse json won’t work because the data you are receiving is already in collection

you cant directly send data to excel sheet you have to convert it to bundles first

use a parse json and add the data then feed the date in to the excel sheet

then connect it to excel and add the values from the parse json

my bad parse json won’t work because the data you are receiving is already in collection

Unfortunately, it doesn’t work. Solutions?

More info about the request

which date value you are trying to map in the excel is it day from picture 1.5 ? you can send output bundle JSON file i will take a look

I’m trying to map the average_hrv data from the HTTP module to Google Sheets. After running the scenario, I can see all the data when I click on the HTTP module (as shown in screenshot 1.5). However, when I try to map the data in the Google Sheets module, the available fields from the HTTP response are significantly reduced. Only the data field, containing the info shown in screenshot 2, is visible.


{
    "name": "Integration HTTP, Google Sheets",
    "flow": [
        {
            "id": 1,
            "module": "http:ActionSendDataOAuth",
            "version": 3,
            "parameters": {
                "account": 2900917,
                "handleErrors": false
            },
            "mapper": {
                "ca": "",
                "qs": [],
                "url": "https://api.ouraring.com/v2/usercollection/sleep?start_date={{formatDate(addDays(now; -1); \"YYYY-MM-DD\")}}&end_date={{formatDate(now; \"YYYY-MM-DD\")}}",
                "data": "",
                "gzip": true,
                "method": "get",
                "headers": [],
                "timeout": "",
                "useMtls": false,
                "bodyType": "raw",
                "contentType": "application/json",
                "serializeUrl": false,
                "shareCookies": false,
                "parseResponse": true,
                "followRedirect": true,
                "useQuerystring": false,
                "followAllRedirects": false,
                "rejectUnauthorized": true
            },
            "metadata": {
                "designer": {
                    "x": 0,
                    "y": 0
                },
                "restore": {
                    "expect": {
                        "qs": {
                            "mode": "chose"
                        },
                        "method": {
                            "mode": "chose",
                            "label": "GET"
                        },
                        "headers": {
                            "mode": "chose"
                        },
                        "bodyType": {
                            "label": "Raw"
                        },
                        "contentType": {
                            "label": "JSON (application/json)"
                        }
                    },
                    "parameters": {
                        "account": {
                            "data": {
                                "scoped": "true",
                                "connection": "oauth2"
                            },
                            "label": "Oura Ring OAuth "
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "account",
                        "type": "account:oauth2",
                        "label": "Connection",
                        "required": true
                    },
                    {
                        "name": "handleErrors",
                        "type": "boolean",
                        "label": "Evaluate all states as errors (except for 2xx and 3xx )",
                        "required": true
                    }
                ],
                "expect": [
                    {
                        "name": "url",
                        "type": "url",
                        "label": "URL",
                        "required": true
                    },
                    {
                        "name": "serializeUrl",
                        "type": "boolean",
                        "label": "Serialize URL",
                        "required": true
                    },
                    {
                        "name": "method",
                        "type": "select",
                        "label": "Method",
                        "required": true,
                        "validate": {
                            "enum": [
                                "get",
                                "head",
                                "post",
                                "put",
                                "patch",
                                "delete",
                                "options"
                            ]
                        }
                    },
                    {
                        "name": "headers",
                        "spec": [
                            {
                                "name": "name",
                                "type": "text",
                                "label": "Name",
                                "required": true
                            },
                            {
                                "name": "value",
                                "type": "text",
                                "label": "Value"
                            }
                        ],
                        "type": "array",
                        "label": "Headers"
                    },
                    {
                        "name": "qs",
                        "spec": [
                            {
                                "name": "name",
                                "type": "text",
                                "label": "Name",
                                "required": true
                            },
                            {
                                "name": "value",
                                "type": "text",
                                "label": "Value"
                            }
                        ],
                        "type": "array",
                        "label": "Query String"
                    },
                    {
                        "name": "bodyType",
                        "type": "select",
                        "label": "Body type",
                        "validate": {
                            "enum": [
                                "raw",
                                "x_www_form_urlencoded",
                                "multipart_form_data"
                            ]
                        }
                    },
                    {
                        "name": "parseResponse",
                        "type": "boolean",
                        "label": "Parse response",
                        "required": true
                    },
                    {
                        "name": "timeout",
                        "type": "uinteger",
                        "label": "Timeout",
                        "validate": {
                            "max": 300,
                            "min": 1
                        }
                    },
                    {
                        "name": "shareCookies",
                        "type": "boolean",
                        "label": "Share cookies with other HTTP modules",
                        "required": true
                    },
                    {
                        "name": "ca",
                        "type": "cert",
                        "label": "Self-signed certificate"
                    },
                    {
                        "name": "rejectUnauthorized",
                        "type": "boolean",
                        "label": "Reject connections that are using unverified (self-signed) certificates",
                        "required": true
                    },
                    {
                        "name": "followRedirect",
                        "type": "boolean",
                        "label": "Follow redirect",
                        "required": true
                    },
                    {
                        "name": "useQuerystring",
                        "type": "boolean",
                        "label": "Disable serialization of multiple same query string keys as arrays",
                        "required": true
                    },
                    {
                        "name": "gzip",
                        "type": "boolean",
                        "label": "Request compressed content",
                        "required": true
                    },
                    {
                        "name": "useMtls",
                        "type": "boolean",
                        "label": "Use Mutual TLS",
                        "required": true
                    },
                    {
                        "name": "contentType",
                        "type": "select",
                        "label": "Content type",
                        "validate": {
                            "enum": [
                                "text/plain",
                                "application/json",
                                "application/xml",
                                "text/xml",
                                "text/html",
                                "custom"
                            ]
                        }
                    },
                    {
                        "name": "data",
                        "type": "buffer",
                        "label": "Request content"
                    },
                    {
                        "name": "followAllRedirects",
                        "type": "boolean",
                        "label": "Follow all redirect",
                        "required": true
                    }
                ]
            }
        },
        {
            "id": 20,
            "module": "google-sheets:addRow",
            "version": 2,
            "parameters": {
                "__IMTCONN__": 2901195
            },
            "mapper": {
                "mode": "select",
                "insertUnformatted": false,
                "valueInputOption": "USER_ENTERED",
                "insertDataOption": "INSERT_ROWS",
                "from": "drive",
                "spreadsheetId": "/12FUyeVj10bdIif1QjUnKq2QPypeIQp1_/1TpW6RS-0XXbyUKhj_Y-ViqmoCiroN7laawFDZtHqbCc",
                "sheetId": "Foglio1",
                "includesHeaders": true,
                "values": {
                    "0": "{{1.data}}",
                    "1": "2",
                    "3": "3"
                }
            },
            "metadata": {
                "designer": {
                    "x": 300,
                    "y": 0
                },
                "restore": {
                    "parameters": {
                        "__IMTCONN__": {
                            "label": "Oura ring connection (Francescoleone.23@icloud.com)",
                            "data": {
                                "scoped": "true",
                                "connection": "google"
                            }
                        }
                    },
                    "expect": {
                        "mode": {
                            "label": "Search by path"
                        },
                        "insertUnformatted": {
                            "mode": "chose"
                        },
                        "valueInputOption": {
                            "mode": "chose",
                            "label": "User entered"
                        },
                        "insertDataOption": {
                            "mode": "chose",
                            "label": "Insert rows"
                        },
                        "from": {
                            "label": "My Drive"
                        },
                        "spreadsheetId": {
                            "path": [
                                "Oura data",
                                "ring.Data"
                            ]
                        },
                        "sheetId": {
                            "label": "Foglio1"
                        },
                        "includesHeaders": {
                            "nested": [
                                {
                                    "name": "values",
                                    "label": "Values",
                                    "type": "collection",
                                    "spec": [
                                        {
                                            "name": "0",
                                            "label": "Titoli  (A)",
                                            "type": "text"
                                        },
                                        {
                                            "name": "1",
                                            "label": "(B)",
                                            "type": "text"
                                        },
                                        {
                                            "name": "2",
                                            "label": "(C)",
                                            "type": "text"
                                        },
                                        {
                                            "name": "3",
                                            "label": "(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": "Search 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": "from",
                        "type": "select",
                        "label": "Drive",
                        "required": true,
                        "validate": {
                            "enum": [
                                "drive",
                                "share",
                                "team"
                            ]
                        }
                    },
                    {
                        "name": "spreadsheetId",
                        "type": "file",
                        "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": "Titoli  (A)"
                            },
                            {
                                "name": "1",
                                "type": "text",
                                "label": "(B)"
                            },
                            {
                                "name": "2",
                                "type": "text",
                                "label": "(C)"
                            },
                            {
                                "name": "3",
                                "type": "text",
                                "label": "(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": {
        "instant": false,
        "version": 1,
        "scenario": {
            "roundtrips": 1,
            "maxErrors": 3,
            "autoCommit": true,
            "autoCommitTriggerLast": true,
            "sequential": false,
            "slots": null,
            "confidential": false,
            "dataloss": false,
            "dlq": false,
            "freshVariables": false
        },
        "designer": {
            "orphans": []
        },
        "zone": "eu2.make.com"
    }
}

You are right the problem lies in the api i Googled

a bit and found out it’s it happening because of the pydantic library being used in the api to validate the date

You can see in the picture 2 that the date is within double quotes

But still you shouldn’t be getting that error while mapping it to excel because you already have the correct data and you haven’t passed the date as string

Have you tried creating a new scenario and trying it again?

Now It works!

3 Likes

Great. How did you work around it?