How can I adjust the amount of records imported with Power Query?

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
I get the same result. Unfortunately I can't read the source HTML well enough to determine what the issue might be.

It might be some sort of API limitation where they deliberately throttle requests. Hopefully someone more expert than I can deliver the solution.
 
Upvote 0
I get the same result. Unfortunately I can't read the source HTML well enough to determine what the issue might be.

It might be some sort of API limitation where they deliberately throttle requests. Hopefully someone more expert than I can deliver the solution.

Thanks for reply. Im new to Power query so picking it up gradually. It has some good features but it can be awkward to use.
 
Upvote 0
Stick with it. In many cases it's a data problem, not PowerQuery.

Here's a query I use to get FX rates from the Wall Street Journal site (you may need a subscription). It makes it easy to price our goods into other currencies once it's in a table, probably something similar to what you'd like to do.

Code:
/*
    Taken from the Wall Street Journal.  Subscription may be required.
    Pct changes where nothing happens show as "unch" in the data, error in the file
    So after changing all values to decimal the query swaps those errors for null values
*/

let
    Source = Web.Page(Web.Contents("http://online.wsj.com/mdc/public/page/2_3021-forex.html")),
    Data0 = Source{0}[Data],
    RenameCols = Table.RenameColumns(Data0,{{"Column1", "Currency"}, {"Column2", "In US$"}, {"Column4", "Pct Chng Yesterday"}, {"Column5", "Pct Chng YTD"}, {"Column6", "Per US$"}}),
    RemoveCols = Table.RemoveColumns(RenameCols,{"Column3", "Column7"}),
    ChangeToDecimal = Table.TransformColumnTypes(RemoveCols,{{"In US$", type number}, {"Pct Chng Yesterday", type number}, {"Pct Chng YTD", type number}, {"Per US$", type number}}),
    RemoveTextRows = Table.RemoveRowsWithErrors(ChangeToDecimal, {"In US$"}),
    ReplacePctChngWithNull = Table.ReplaceErrorValues(RemoveTextRows, {{"Pct Chng Yesterday", null}}),
    ReplacePctChngYTDWithNull = Table.ReplaceErrorValues(ReplacePctChngWithNull, {{"Pct Chng YTD", null}})
in
    ReplacePctChngYTDWithNull
 
Upvote 0
Stick with it. In many cases it's a data problem, not PowerQuery.

Here's a query I use to get FX rates from the Wall Street Journal site (you may need a subscription). It makes it easy to price our goods into other currencies once it's in a table, probably something similar to what you'd like to do.

Code:
/*
    Taken from the Wall Street Journal.  Subscription may be required.
    Pct changes where nothing happens show as "unch" in the data, error in the file
    So after changing all values to decimal the query swaps those errors for null values
*/

let
    Source = Web.Page(Web.Contents("http://online.wsj.com/mdc/public/page/2_3021-forex.html")),
    Data0 = Source{0}[Data],
    RenameCols = Table.RenameColumns(Data0,{{"Column1", "Currency"}, {"Column2", "In US$"}, {"Column4", "Pct Chng Yesterday"}, {"Column5", "Pct Chng YTD"}, {"Column6", "Per US$"}}),
    RemoveCols = Table.RemoveColumns(RenameCols,{"Column3", "Column7"}),
    ChangeToDecimal = Table.TransformColumnTypes(RemoveCols,{{"In US$", type number}, {"Pct Chng Yesterday", type number}, {"Pct Chng YTD", type number}, {"Per US$", type number}}),
    RemoveTextRows = Table.RemoveRowsWithErrors(ChangeToDecimal, {"In US$"}),
    ReplacePctChngWithNull = Table.ReplaceErrorValues(RemoveTextRows, {{"Pct Chng Yesterday", null}}),
    ReplacePctChngYTDWithNull = Table.ReplaceErrorValues(ReplacePctChngWithNull, {{"Pct Chng YTD", null}})
in
    ReplacePctChngYTDWithNull

Thank you, ill see can I alter this code to do what I want. Ill post back here later
 
Upvote 0
It may not be elegant, but I can just read the currency page into a web query directly in Excel (Data...From Web...) then use the 11 resulting columns as a source in PowerQuery to clean it up. It imports lots of junk, but the actual table is the only piece that has all 11 columns, so its easy to filter out the other rows
 
Upvote 0
Depending on your Excel version choose either the Power Query ribbon or Get & Transform on the Data ribbon. From Other Sources --> Blank Query will open a new query in the query editor. Find the Advanced Editor button and in the window that opens delete the default text and paste the new query text.
 
Upvote 0
It may not be elegant, but I can just read the currency page into a web query directly in Excel (Data...From Web...) then use the 11 resulting columns as a source in PowerQuery to clean it up. It imports lots of junk, but the actual table is the only piece that has all 11 columns, so its easy to filter out the other rows

Good idea about using the web query, however it still only imports 100 records. I find the web query difficult to use because it keeps giving script errors. Some websites are unusable with it.

@macfuller
=]Depending on your Excel version choose either the Power Query ribbon or Get & Transform on the Data ribbon. From Other Sources --> Blank Query will open a new query in the query editor. Find the Advanced Editor button and in the window that opens delete the default text and paste the new query text.

Thanks, Ill try this.
Hopefully Ill write the new query correctly. Can someone confirm what the query language of Power Query is. Im not familiar with the Let and In commands
 
Last edited:
Upvote 0
Ive just tried this but it gives a Token Expected error.
Code:
let
    Source = Web.Page(Web.Contents("https://www.investing.com/crypto/currencies")),
    Data0 = Source{0}[Data]
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,315
Members
452,634
Latest member
cpostell

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
Back
Top