excelexcel-web-queryvba

Excel Web Query pulls only half of the table


I came across web queries option in excel just an hour ago, so please pardon my naivety. I am trying to pull a table from this page on BLS, however I am getting only first part of the table whereas I need only the second part of the table (or the full table). I am trying to import the part with historical data just below download xlsx button. It is part of the table which starts from "Series Id: CES2000000001" and ends at "P : preliminary". One thing I noticed that the table does not have any id, and excel reads its name as "3"


Solution

  • The table is not in a good format for excel "from web" in the data tab from my test. However, if you download Microsoft's Excel Power Query Add-in (or use Excel 2016) then I found that it detects the table correctly.

    After downloading powery query, simply go to the 'Power Query' tab instead of 'data' and select 'from web' and enter the website. You'll get a screen like below.

    Please note however, if this is a one time deal you can simply select the HTML table by dragging over it with your mouse, copy it, and paste it directly into excel.

    Example of PowerQuery Table for your selection.