vba - Excel - Query for CSV missing columns -


so i'm using office 2016's new query feature data various csv api endpoints. managed work yahoo finance's can't seem morningstar's work. when visit link in browser, download full csv proper data:

link: http://financials.morningstar.com/ajax/reportprocess4csv.html?t=msft&reporttype=is&period=12&datatype=a&order=asc&columnyear=10&number=3

however, when use query feature, loads first row. i'm guessing it's because first column in first row in csv has data, causing ignore rest of columns. know how ignore first row , begin importing csv second?

let     source = csv.document(web.contents("http://financials.morningstar.com/ajax/reportprocess4csv.html?t=msft&reporttype=is&period=12&datatype=a&order=asc&columnyear=10&number=3"),[delimiter=",",encoding=1252]) in     source 

thanks in advance!

edit: in csv.document, looks there's extravalues parameter; maybe might help?

the values parameter can retrieve rows (using extravalues.list), shape of table difficult work with.

here's 1 way values:

let source = table.fromcolumns({lines.frombinary((web.contents("http://financials.morningstar.com/ajax/reportprocess4csv.html?t=msft&reporttype=is&period=12&datatype=a&order=asc&columnyear=10&number=3")),null,null,1252)}), #"removed top rows" = table.skip(source,1), #"split column delimiter" = table.splitcolumn(#"removed top rows","column1",splitter.splittextbydelimiter(",", quotestyle.csv),{"column1.1", "column1.2", "column1.3", "column1.4", "column1.5", "column1.6", "column1.7"}), #"changed type" = table.transformcolumntypes(#"split column delimiter",{{"column1.1", type text}, {"column1.2", type text}, {"column1.3", type text}, {"column1.4", type text}, {"column1.5", type text}, {"column1.6", type text}, {"column1.7", type text}}), #"promoted headers" = table.promoteheaders(#"changed type") in #"promoted headers"

this query treats csv file text document of lines. removes first line, header statement causes parser think csv file has 1 column. splits lines columns based on comma placement , makes first row column names.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -