Power Query URL Change

msarfaraz

New Member
Joined
Oct 18, 2012
Messages
46
let
Source = Csv.Document(Web.Contents("https://query1.finance.yahoo.com/v7/finance/download/" & "BTC-USD" & "?period1=1581415348&period2=1613037748&interval=1d&events=history&includeAdjustedClose=true"),[Delimiter=",", Columns=7, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Date", type date}, {"Open", type number}, {"High", type number}, {"Low", type number}, {"Close", type number}, {"Adj Close", type number}, {"Volume", Int64.Type}})
in
#"Changed Type"



How I can change the above query instead of "BTC-USD" I want a column (Text field) to pick the dynamically.
 

JustynaMK

Well-known Member
Joined
Aug 28, 2016
Messages
674
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
Can you paste your Power Query for me at that stage?
Something's not right with your URL, it is literally parsing word "ticker" instead of the entries of column "Ticker".
Also, paste the Power Query for your formula query as it might be constructed incorrectly (although I doubt it, since you already tested it for a smaller sample and it was all working fine).

1613056593783.png
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

msarfaraz

New Member
Joined
Oct 18, 2012
Messages
46
(Ticker as text) as table =>

let
Source = Csv.Document(Web.Contents("https://query1.finance.yahoo.com/v7/finance/download/" & "Ticker" & "?period1=1581415348&period2=1613037748&interval=1d&events=history&includeAdjustedClose=true"),[Delimiter=",", Columns=7, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Date", type date}, {"Open", type number}, {"High", type number}, {"Low", type number}, {"Close", type number}, {"Adj Close", type number}, {"Volume", Int64.Type}})
in
#"Changed Type"
 

JustynaMK

Well-known Member
Joined
Aug 28, 2016
Messages
674
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
You're most welcome :) take care.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,450
Messages
5,636,337
Members
416,914
Latest member
DWC199

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top