SOLVED

Is Web.Contents different in Excel Power Query than Power BI? No "RelativePath"

Copper Contributor

I've been working with Power Query in Power BI and recently tried to move to Excel a function that worked fine in Power BI. The query uses Web.Contents() with the parameter RelativePath. However when I try this in Excel, I get this error:

"Expression.Error: Option 'RelativePath' isn't a valid Web.Contents option. Valid options are:
ApiKeyName, Content, ExcludedFromCacheKey, Headers, IsRetry, ManualStatusHandling, Query, Timeout"

I was using RelativePath because it allowed me to avoid some difficult permissions issues, whereby Power Query was requiring me to enter credentials for every single web data source. That is impractical when the source names are dynamic. With RelativePath, this problem went away (in Power BI). But apparently the M functions are different in Excel?

 

6 Replies
best response confirmed by elkbane (Copper Contributor)
Solution

@elkbane 

Just tried

let
    Source = Web.Contents(
    "https://data.gov.uk/api", 
    [
        RelativePath="3/action/package_search", 
        Query=
            [q="cows", rows="20"]
    ]
)
in
    Source

(sample from Chris Webb) it works. I'm on Power Query version

image.png

 

@Sergei Baklanthank you very much. How can I check the version of Power Query that I have on Excel? I have two different environments and in one, the sample you provided works. I the other, it fails and gives me the same error I got before.

 

Expression.Error: Option 'RelativePath' isn't a valid Web.Contents option. Valid options are:
ApiKeyName, Content, ExcludedFromCacheKey, Headers, IsRetry, ManualStatusHandling, Query, Timeout

 

I've searched this forum and elsewhere but I can't find how to check my version of Power Query. Where is that accessed?

Whoops - a little more searching and I found it. Instructions were here:

https://www.excelguru.ca/forums/showthread.php?7027-Update-Excel-2016-PQ-(-Get-and-Transform-)-to-La...

An the version of Excel where "RelativePath" fails is

elkbane_0-1595369584061.png

and the installation where the query works is:

@elkbane 

Yes, version 2.24 is quite old. On the other hand as I remember Relative Path was in Power Query for years. Perhaps some details of syntax and parameters were changed, not sure.

In general yes, Power Query is different for different branches. Excel version is some behind the version for Power BI Desktop, and within Excel is also the difference - that's end of support Power Query add-in, PQ for Mac is limited version of PQ for Excel for 365, etc.

Our devops folks upgraded that instance of Excel from 2016 to O365 (2019) and now I'm in business. My query is working in Excel as it does in Power BI. Greatly appreciate your help.

@elkbane Great, glad to know you sorted this out

1 best response

Accepted Solutions
best response confirmed by elkbane (Copper Contributor)
Solution

@elkbane 

Just tried

let
    Source = Web.Contents(
    "https://data.gov.uk/api", 
    [
        RelativePath="3/action/package_search", 
        Query=
            [q="cows", rows="20"]
    ]
)
in
    Source

(sample from Chris Webb) it works. I'm on Power Query version

image.png

 

View solution in original post