What is your goal?
Get Missing Dates and Create an Array of Missing Days and Join with Original Array
What is the problem & what have you tried?
I want to achieve below. I have an array in this structure:
[
{
“segments_date”: “2025-12-01”,
“metrics_costMicros”: “8968591”
},
{
“segments_date”: “2025-12-02”,
“metrics_costMicros”: “7980000”
}
]
Now as come may be aware if the cost is zero Google Ads doesnt include that date in the result. This is resulting in breaking my automation. So I build an array with Available Dates. (Attached Screenshot). Is there a away i can identify missing dates in this case 12 ,14 and then create and array like this:
[
{
“segments_date”: “2025-12-12”,
“metrics_costMicros”: “00.00”
},
{
“segments_date”: “2025-12-14”,
“metrics_costMicros”: “00.00”
}
]
And then join both the arrays and sort by date so that my automation doesnt break.
