Forum Discussion
PaulBoyes
10 years agoRegular Visitor
csv data - not recognising first line as file names.
I am using a number of CSV files as a data source. Mostly this is fine but there are a couple of files where Power BI does not recognise that the first line contains the field names. So when I...
Anonymous
10 years agoNot applicable
Hi PaulBoyes,
Could you please share sample data of the problem CSV file? And we need to know what is the connection string in your Advanced editor.
Based on my test, Power BI will add "Promoted Headers" in Advanced editor when you import CSV file which contains field names, below is an example for your reference.
let
Source = Csv.Document(File.Contents("C: \Sparkline-excel.csv"),[Delimiter=",", Columns=2, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Category ", type text}, {"value", Int64.Type}})
in
#"Changed Type"
And in your scenario, you can use the first row as headers to work around this issue.
Thanks,
Lydia Zhang