Search code examples
excelapirestpowerquerym

Query don't want to complete the URL


I want to complete the URL with an ID i can enter in a table. When I tell the query to get the missing part of the URL from a table i get this error:

Expression.Error: We cannot convert a value of type Table to type Record. Details: Value=[Table] Type=[Type]

Does anyone know how to fix this?

The code:

let
Id = Excel.CurrentWorkbook(){[Name="ID"]}[Content],//gets the missing part of the url
//For example I want to enter ".com" 


URL = "https://www.mywebsite",//URL
Source = Json.Document(Web.Contents(URL , Id))//The file I want to get is a json document
in
    Source

Solution

  • try

    let Id= Excel.CurrentWorkbook(){[Name="ID"]}[Content]{0}[Column1],
    URL = "https://www.mywebsite",
    Source = Json.Document(Web.Contents(URL & Text.From(Id)))
    in Source