Import JSON into Google Sheets

Hey, my question is not directly related to Glide, but I need your help. I’m working on a business directory and I want to use Google Places API (Google Maps) for opening hours, so I won’t need to update it manually and to keep it updated. I managed to use https://maps.googleapis.com/maps/api/place/details/json?place_id=PLACE_ID&fields=opening_hours&language=iw&key=API_KEY to get this:

JSON
{
   "html_attributions" : [],
   "result" : {
      "opening_hours" : {
         "open_now" : true,
         "periods" : [
            {
               "close" : {
                  "day" : 1,
                  "time" : "0000"
               },
               "open" : {
                  "day" : 0,
                  "time" : "1200"
               }
            },
            {
               "close" : {
                  "day" : 2,
                  "time" : "0000"
               },
               "open" : {
                  "day" : 1,
                  "time" : "1200"
               }
            },
            {
               "close" : {
                  "day" : 3,
                  "time" : "0000"
               },
               "open" : {
                  "day" : 2,
                  "time" : "1200"
               }
            },
            {
               "close" : {
                  "day" : 4,
                  "time" : "0000"
               },
               "open" : {
                  "day" : 3,
                  "time" : "1200"
               }
            },
            {
               "close" : {
                  "day" : 5,
                  "time" : "0000"
               },
               "open" : {
                  "day" : 4,
                  "time" : "1200"
               }
            },
            {
               "close" : {
                  "day" : 6,
                  "time" : "0000"
               },
               "open" : {
                  "day" : 5,
                  "time" : "1200"
               }
            },
            {
               "close" : {
                  "day" : 0,
                  "time" : "0000"
               },
               "open" : {
                  "day" : 6,
                  "time" : "1200"
               }
            }
         ],
         "weekday_text" : [
            "יום ראשון: 12:00–0:00",
            "יום שני: 12:00–0:00",
            "יום שלישי: 12:00–0:00",
            "יום רביעי: 12:00–0:00",
            "יום חמישי: 12:00–0:00",
            "יום שישי: 12:00–0:00",
            "יום שבת: 12:00–0:00"
         ]
      }
   },
   "status" : "OK"
}

But now I don’t know how to import it to Google Sheets to be something like this (using the “weekday_text” property, note that in my country Sunday is the first day of the week, and we use Right-to-Left):

╒═════════════════════╤═════════════════════╤═════════════════════╤═════════════════════╤═════════════════════╤═════════════════════╤═════════════════════╕
│ Saturday            │ Friday              │ Thursday            │ Wednesday           │ Tuesday             │ Monday              │ Sunday              │
╞═════════════════════╪═════════════════════╪═════════════════════╪═════════════════════╪═════════════════════╪═════════════════════╪═════════════════════╡
│ 12:00 PM – 12:00 AM │ 12:00 PM – 12:00 AM │ 12:00 PM – 12:00 AM │ 12:00 PM – 12:00 AM │ 12:00 PM – 12:00 AM │ 12:00 PM – 12:00 AM │ 12:00 PM – 12:00 AM │
╘═════════════════════╧═════════════════════╧═════════════════════╧═════════════════════╧═════════════════════╧═════════════════════╧═════════════════════╛

By the end, I want to include it on my Glide app as a Basic Table element. Any tip will be helpful!

If you’re not scared of getting your hands dirty with a bit of Apps Script, then this is easy enough.

5 Likes