SSIS supports Power Query as a Source, but do not seem to support M code using a function.
If you try to do that you will get an error
Error = Exception 0x80004005 The import Product matches no exports. Did you miss a Module
As you can see in the Attached file the code runs in Power BI, but not in SSIS most likely you cannot reference to another Power Query Source like you do in Power BI error message
The solution is to merge the function and the Query into one or what is commonly known "Inline Function" so the Query will look like this
let Scrapper =
(Page as number) as table =>
let
Source = Web.BrowserContents("https://www.zerohedge.com/?page=" & Number.ToText(Page)),
#"Extracted Table From Html" = Html.Table(Source, {{"Title", ".teaser-title:nth-last-child(4)"}, {"Date", ".extras__created:nth-last-child(1)"}, {"Views", ".extras__views:nth-last-child(2)"}}, [RowSelector=".view-content:nth-last-child(2) > DIV.views-row"]),
#"Changed Type" = Table.TransformColumnTypes(#"Extracted Table From Html",{{"Title", type text}, {"Date", type datetime}, {"Views", Int64.Type}})
in
#"Changed Type",
Source = {0..10},
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Pages"}}),
#"Invoked Custom Function" = Table.AddColumn(#"Renamed Columns", "Scrapper", each Scrapper([Pages])),
#"Expanded Scrapper" = Table.ExpandTableColumn(#"Invoked Custom Function", "Scrapper", {"Title", "Date", "Views"}, {"Title", "Date", "Views"})
in
#"Expanded Scrapper"
But still doing so you will get no response in SSIS With error=
Error: 0x0 at Data Flow Task, Power Query Source: The import Html.Table matches no exports. Did you miss a module reference?
so I think it may be a bug since is still in preview. I don't know how to get in contact With the SQL team at Microsoft so I'm posting this if any can forward this to them :-)
User contributions licensed under CC BY-SA 3.0