Forum Discussion
Issue when importing CSV file
DenHaa in this case remove the columns=26 from the code and also remove the steps which is changing the type of the columns.
refer to below articles for more help
Always import all columns from CSV file with Power Query (datacornering.com)
Thanks negi007 & themistoklis for your replies 🙂
I have tried this and then it will only load the first 16 columns.
My query now looks like this:
let
Source = Csv.Document(Web.Contents("$url"),[Delimiter=",", Encoding=65001, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true])
in
#"Promoted Headers"
But the results is only 16 columns:
If I then manually enter 26 columns, it will fill them with data in the visual window but still class them as empty?
- negi0074 years agoCommunity Champion
DenHaa your code is slighlty different. i have just imported the file and was able to get new columns using below code. Can you try using it.
let
Source = Csv.Document(Web.Contents("https://abc/xyz.csv"),[Delimiter=",", Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true])
in
#"Promoted Headers"- DenHaa4 years agoFrequent Visitor
The only change I could see was the Encoding, correct?
When I changed the Encoding to 1252, all of the 26 columns show up when I refresh but they still give an error:
And if I try to change the type of one of the fields, I get the following error:
Here is my current query:
let Source = Csv.Document(Web.Contents("$url"),[Delimiter=",", Encoding=1252, QuoteStyle=QuoteStyle.None]), #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]), #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Assigned Date", type datetime}}) in #"Changed Type"