Forum Discussion
Web.content error when combining queries
I got a bit further. I made a function from both calls like suggested in some of the links.
So this is the function which calls the Auth Code, with the Auth URL as input:
let LoadAuthCode = (URLAuth as text) =>
let
AccessKeyParam = YukiAccessKey,
BronAccessKey = Xml.Tables(Web.Contents(URLAuth, [Query=[accessKey=Text.From(AccessKeyParam)]])),
in
BronAccessKey
in
LoadAuthCode
URLauth I get from this function:
let
Bron = () => let
Source = "**GoogleSheetLink**",
URLPre = Text.Replace(Source,"https://docs.google.com/",""),
SourceCSV = Csv.Document(Web.Contents("https://docs.google.com", [RelativePath = URLPre])),
Column1 = SourceCSV{1}[Column2],
#"Geconverteerd naar tabel" = #table(1, {{Column1}})
in
#"Geconverteerd naar tabel"
in
Bron
Both functions work, also in PBI online environment.
Troubles start now;
I call the 2nd function and add a column where I call the 1st function with the URL gotten in 2nd function as input:
let
Bron = FunctieAuthURL(),
#"Aangepaste kolom toegevoegd" = Table.AddColumn(Bron, "Aangepast", each FunctionAuthCode([Column1]))
in
#"Aangepaste kolom toegevoegd"
It give me a result, but in PBI Online I run into this error:
Query contains unsupported function. Function name: Web.Contents
It's strange, because I call both data sources (AuthURL and AuthCode) in 2 different datasources, refer to them in 2 different functions. I combine them in a third function.
How come this doesn't work?
You might find it's a security level issue. Try combining the functions and query into a single source.
Not tested this but fingers crossed.
let
FunctieAuthURL =
let
Bron = () => let
Source = "**GoogleSheetLink**",
URLPre = Text.Replace(Source,"https://docs.google.com/",""),
SourceCSV = Csv.Document(Web.Contents("https://docs.google.com", [RelativePath = URLPre])),
Column1 = SourceCSV{1}[Column2],
#"Geconverteerd naar tabel" = #table(1, {{Column1}})
in
#"Geconverteerd naar tabel"
in
Bron,
FunctionAuthCode =
let LoadAuthCode = (URLAuth as text) =>
let
AccessKeyParam = YukiAccessKey,
BronAccessKey = Xml.Tables(Web.Contents(URLAuth, [Query=[accessKey=Text.From(AccessKeyParam)]]))
in
BronAccessKey
in
LoadAuthCode,
Bron = FunctieAuthURL(),
#"Aangepaste kolom toegevoegd" = Table.AddColumn(Bron, "Aangepast", each FunctionAuthCode([Column1]))
in
#"Aangepaste kolom toegevoegd"- Arendp6 years agoHelper III
Works good in Desktop!
Made a minor change, added the AccessKey to function FunctionAuthCode()
Still I get the message Query contains unsupported function. Function name: Web.Contents
In the online environment...
let FunctieAuthURL = let Bron = () => let Source = "***GoogleSheetLink***", URLPre = Text.Replace(Source,"https://docs.google.com/",""), SourceCSV = Csv.Document(Web.Contents("https://docs.google.com", [RelativePath = URLPre])), Column1 = SourceCSV{1}[Column2], #"Geconverteerd naar tabel" = #table(1, {{Column1}}) in #"Geconverteerd naar tabel" in Bron, FunctionAuthCode = let LoadAuthCode = (URLAuth as text, YukiAccessKey as text) => let BronAccessKey = Xml.Tables(Web.Contents(URLAuth, [Query=[accessKey=YukiAccessKey]])) in BronAccessKey in LoadAuthCode, Bron = FunctieAuthURL(), #"Aangepaste kolom toegevoegd" = Table.AddColumn(Bron, "Aangepast", each FunctionAuthCode([Column1], Text.From("***AccessKey***"))), #"Aangepast uitgevouwen" = Table.ExpandTableColumn(#"Aangepaste kolom toegevoegd", "Aangepast", {"Element:Text"}, {"Aangepast.Element:Text"}) in #"Aangepast uitgevouwen"As mentioned, all is on Anonymous / Public.
- aTChris6 years agoResolver I
I find it strange that the functions in the cloud separately. I assume that the issue is with the Web.Contents(URL.Auth,
The only solution im aware of is currently disabled. PowerBI Cloud has a feature to skip the test but its currently disabled.
Hope they enable it again soon for you.