Reputation: 739
I want to download the table that is in this page about Libor rates:
http://online.wsj.com/mdc/public/page/2_3020-libor.html (Specificaly, the one that its about USD)
By using data/import from web, if I select the table once I press import it does not appear the table, but that one appears if I import the whole page
Is there a way, using VBA may be, where I can obtain that table?
Upvotes: 0
Views: 709
Reputation: 35915
As an alternative to VBA, you can download and install the free Microsoft Add-In for Excel called Power Query. With Power Query installed, the steps are:
Now you only need to refresh the data connections when the web site has new numbers.
The screenshot has the Excel file with the Power Query ribbon and the result table in the background. The window on top is the Power Query interface. The transformation steps are listed in the panel on the right.
Each transformation step is recorded in a language called "M". In Power Query you can click View > Advanced Editor to view and change the M code. It is a very powerful language with a syntax that is quite different from Excel formulas or VBA. I'm just mentioning it here to make you aware that the transformations can be customized beyond clicking icons on the ribbon. The generated code is:
let
Source = Web.Page(Web.Contents("http://online.wsj.com/mdc/public/page/2_3020-libor.html")),
Data0 = Source{0}[Data],
#"Changed Type" = Table.TransformColumnTypes(Data0,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}}),
#"Removed Top Rows" = Table.Skip(#"Changed Type",1),
#"First Row as Header" = Table.PromoteHeaders(#"Removed Top Rows"),
#"Removed Bottom Rows" = Table.RemoveLastN(#"First Row as Header",27)
in
#"Removed Bottom Rows"
Upvotes: 1