none
Google Places API and Power Query Function RRS feed

  • Question

  • Hi

    I have written the code below to return a list of Shopping Centres from Google Places with a formatted address. The API will only return the first 20 results and a page_token to retrieve the following 20. The URL for the next 20 results is the URL in the code &page_token[page_token]. I know that a new page_token is issued for each 20 results

    I am struggling to set up the query to make use of the page tokens and retrieve all the results. Does anyone have any suggestions on how best to do this?

    Many thanks

    Dave

    let
    
    LOCATION = (location as text) =>
    
    
    let
        Source = Json.Document(Web.Contents("https://maps.googleapis.com/maps/api/place/search/json?location="&location&"&radius=5000&sensor=true&key=[YOUR_API_KEY]&types=shopping_mall")),
        #"Converted to Table" = Record.ToTable(Source),
        Value = #"Converted to Table"{2}[Value],
        #"Converted to Table1" = Table.FromList(Value, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
        #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table1", "Column1", {"id", "name", "place_id", "reference", "types", "vicinity"}, {"id", "name", "place_id", "reference", "types", "vicinity"}),
        #"Expanded types" = Table.ExpandListColumn(#"Expanded Column1", "types"),
        #"Filtered Rows" = Table.SelectRows(#"Expanded types", each ([types] = "shopping_mall"))
    in
        #"Filtered Rows"
    
    in LOCATION

    Wednesday, August 31, 2016 10:37 AM

Answers

All replies