Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PaulBoyes
Regular 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 look at the column names for those files they are displayed as Column1, Column 2 etc instead of the field names.

 

If I use Excel or Notepad to open the files it is absolutely fine.  I simply cannot detect any problem with these files.

3 REPLIES 3
Beckham
Advocate II
Advocate II

This happens to me all the time. When you import it using powerquery, click on the button that says "Use First Row As Headers". Should fix it. 

 

 

 

1.PNG

My home tab does not show the "set first row as headers" option

v-yuezhe-msft
Employee
Employee

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

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.