why do two csv file behave differently on import?

jono

New member
Joined
Dec 31, 2015
Messages
26
Reaction score
1
Points
3
Excel Version(s)
2016
Hi,
I have two CSV files, both have column names as the first row, when I import one it uses the first row as table column names, when I do the same with the second one the first row is not used as column names instead appear under "column1","column2"

"Username","Course Name","User Last Access Date","Company Name"1694691061867.png

"Company Name","Account Owner","Partner Program","Account Territory"
1694691111048.png

I thought it might have been the difference in the 65001 and 1252, changing to match makes no difference.

OK, I can fix this by renaming the columns for the "data" table and delete row 2, but curiosity is making me wonder why I've having to do that in the first place?

Thank you
Jon
 
Could you zip up the 2 csv files and attach them here?
If it's too sensitive for the public domain, perhaps you could send me a message here in a Private Conversation?
 
I've stripped out and replaced second line data with dummy, I was worried that re-saving it from Notepad++ would fix any weird encoding taking place but please to say 'signed_up' works with headers going in on row 1,when importing 'data' it adds headers as row 2 etc.

This is only for curiosity, there is a option to 'use first row as headers' etc, both files come via different applications.

Any way, Thank you
Jon
 

Attachments

  • csv samples.zip
    499 bytes · Views: 5
When I loaded your csv files into Power Query, I too got different treatments re headers, but both queries' first lines were similar:
Code:
= Csv.Document(File.Contents("C:\Users\Public\Downloads\csv samples\Signed_up.csv"),[Delimiter=",", Columns=4, Encoding=1252, QuoteStyle=QuoteStyle.None])
= Csv.Document(File.Contents("C:\Users\Public\Downloads\csv samples\data.csv")     ,[Delimiter=",", Columns=4, Encoding=1252, QuoteStyle=QuoteStyle.None])
however, one promoted headers automatically, the other didn't.
So I'm perplexed too!
 
At least it is not me being stupid :)
 
I think it's just the nature of the data content. The data.csv file is all text so it's not obvious that the first row is any different from the rest; if you alter the second row to include a number or date somewhere, it should then automatically detect a header.
 
Back
Top