Hi Make.com Community!
I have a JSON with dynamic array sizes (e.g., daily itinerary varies by trip length). I need to write this data to a Google Docs template, but I’m struggling to make the content adjust dynamically based on the array length (e.g., 3-day trip vs. 7-day trip).
Automation Scenario:
Json Format:
Right now i am doing it like this:
Daily Itinerary
Day 1 ({{formatDate(addDays(10.user.travel_start_date; 0); "DD/MM/YYYY")}})
- Morning: {{10.daily_activities.day_1.morning}}
- Afternoon: {{10.daily_activities.day_1.afternoon}}
- Evening: {{10.daily_activities.day_1.evening}}
Day 2 ({{formatDate(addDays(10.user.travel_start_date; 1); "DD/MM/YYYY")}})
- Morning: {{10.daily_activities.day_2.morning}}
- Afternoon: {{10.daily_activities.day_2.afternoon}}
- Evening: {{10.daily_activities.day_2.evening}}
Day 3 ({{formatDate(addDays(10.user.travel_start_date; 2); "DD/MM/YYYY")}})
- Morning: {{10.daily_activities.day_3.morning}}
- Afternoon: {{10.daily_activities.day_3.afternoon}}
- Evening: {{10.daily_activities.day_3.evening}}
Day 4 ({{formatDate(addDays(10.user.travel_start_date; 3); "DD/MM/YYYY")}})
- Morning: {{10.daily_activities.day_4.morning}}
- Afternoon: {{10.daily_activities.day_4.afternoon}}
- Evening: {{10.daily_activities.day_4.evening}}
Day 5 ({{formatDate(addDays(10.user.travel_start_date; 4); "DD/MM/YYYY")}})
- Morning: {{10.daily_activities.day_5.morning}}
- Afternoon: {{10.daily_activities.day_5.afternoon}}
- Evening: {{10.daily_activities.day_5.evening}}
Day 6 ({{formatDate(addDays(10.user.travel_start_date; 5); "DD/MM/YYYY")}})
- Morning: {{10.daily_activities.day_6.morning}}
- Afternoon: {{10.daily_activities.day_6.afternoon}}
- Evening: {{10.daily_activities.day_6.evening}}
Day 7 ({{formatDate(addDays(10.user.travel_start_date; 6); "DD/MM/YYYY")}})
- Morning: {{10.daily_activities.day_7.morning}}
- Afternoon: {{10.daily_activities.day_7.afternoon}}
- Evening: {{10.daily_activities.day_7.evening}}
Questions:
- How can I dynamically generate content in Google Docs based on the array size?
- Can I do this without using iterators or complex operations?
- What’s the best method for handling this efficiently?
Thanks in advance for your help!