Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ChriGau
Frequent Visitor

Connect to a dynamic URL stored in a table

Dear all,

 

I need to connect to a URL to export a .csv file. This URL changes everyday. Let's call it (1).

To get to know the value of (1), I need to connect to another URL. Let's call it (2).

When connected to (2), I can load its data, i.e. a table (1 column, 1 row) which contains URL (1).

 

Now, how do I connect to (1) according to the value of (2)?

 

Many thanks! 😉

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @ChriGau,

 

You can refer to below steps:

 

1. Get data from csv file.
2. Reference above query and get the stored url.

 

Urlstring=List.First(#"Query Name"[ColumnName])

3. Write a custom function to get data from web with parameter url.

 

 

let
    GetDataFromWeb = (url as text) =>
let
    Source = Web.Page(Web.Contents(url)),
    DataSource= Source{0}[Data]
in
    DataSource
in
    GetDataFromWeb

 

 

Use sample: Invoke the custom function with random text string, open the advanced editor and use the analysed url to replace current value.

 

let
    Source = GetDataFromWeb(List.First(Query1[Url]))
in
    Source

 

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Dear all

 

I'm currently stuck in a similar situation where I am trying to access data via an API which in turn in stored inside of a table.

 

Is there a way to go about extracting that URL string from the table and then fetching the data?

 

Friendly regards

v-shex-msft
Community Support
Community Support

Hi @ChriGau,

 

You can refer to below steps:

 

1. Get data from csv file.
2. Reference above query and get the stored url.

 

Urlstring=List.First(#"Query Name"[ColumnName])

3. Write a custom function to get data from web with parameter url.

 

 

let
    GetDataFromWeb = (url as text) =>
let
    Source = Web.Page(Web.Contents(url)),
    DataSource= Source{0}[Data]
in
    DataSource
in
    GetDataFromWeb

 

 

Use sample: Invoke the custom function with random text string, open the advanced editor and use the analysed url to replace current value.

 

let
    Source = GetDataFromWeb(List.First(Query1[Url]))
in
    Source

 

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi,

if  the table contains 1 column, multiple row, which contains URL (1). How to get the data?

Many Thanks.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.