cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Power Query importing CSV from folder error

Hey all, 

 

I am trying to create a Power Query from a folder which contains a CSV file.

Unfortunatly i am getting an error.

 

After clicking on the " Binary" sign, i get the error below.

I think it's due to the Delimiter.
But i don't know how to solve it.

 

Does anybody now how to solve this?
Thanks in advance!!!!

 

1.JPG

 

2.JPG

 
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User I
Super User I

Re: Power Query importing CSV from folder error

Hi @Vianney123 

 

Try this:

let
    Source = Folder.Files("O:\EXPIRATIES"),
    #"Sorted Rows" = Table.Sort(Source,{{"Date created", Order.Descending}}),
    #"Kept First Rows" = Table.FirstN(#"Sorted Rows",1),
    ImportCSV = Csv.Document(#"Kept First Rows"{0}[Content],[Delimiter=";", Columns=1, Encoding=65001, QuoteStyle=QuoteStyle.None])
in
    ImportCSV

 

Kind regards,

JB

View solution in original post

5 REPLIES 5
Highlighted
Super User I
Super User I

Re: Power Query importing CSV from folder error

Hello @Vianney123 

 

what is the idea to read from the folder and then from csv-file?

If you only need this file only, query your file directly with the TXT/CSV function. This help importing your data with a special wizard. If you need do read the binary data from your flder consider using this csv-converting function like this (your file seems european standard and devided with semicolon)

= Csv.Document(YourBinaryDataUsindForExampleFileContents,[Delimiter=";", Columns=4, Encoding=1252, QuoteStyle=QuoteStyle.None])

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

Highlighted
Community Support
Community Support

Re: Power Query importing CSV from folder error

Hi @Vianney123 ,

 

We can change the "Imported CSV" step, from

 

= Csv.Document(#"Previous Step Name",[Delimiter=",", Columns=1, Encoding=65001, QuoteStyle=QuoteStyle.None])

 

To

 

= Csv.Document(#"Previous Step Name",[Delimiter=";", Columns=1, Encoding=65001, QuoteStyle=QuoteStyle.None])

 

13.jpg

 

Then we can add a "Use First Row as Headers" step after imported CSV

 

14.jpg

 


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Regular Visitor

Re: Power Query importing CSV from folder error

Hey v-lid-msft,


Thanks for your response 🙂

Unfortunately i seem to be unable to adjust your steps 😞

 

Do you perhaps know what i should add in the advanced editor?

 

Thanks in advance,

Vianney123

 

let
Source = Folder.Files("O:\EXPIRATIES"),
#"Sorted Rows" = Table.Sort(Source,{{"Date created", Order.Descending}}),
#"Kept First Rows" = Table.FirstN(#"Sorted Rows",1)
in
#"Kept First Rows"

Highlighted
Super User I
Super User I

Re: Power Query importing CSV from folder error

Hi @Vianney123 

 

Try this:

let
    Source = Folder.Files("O:\EXPIRATIES"),
    #"Sorted Rows" = Table.Sort(Source,{{"Date created", Order.Descending}}),
    #"Kept First Rows" = Table.FirstN(#"Sorted Rows",1),
    ImportCSV = Csv.Document(#"Kept First Rows"{0}[Content],[Delimiter=";", Columns=1, Encoding=65001, QuoteStyle=QuoteStyle.None])
in
    ImportCSV

 

Kind regards,

JB

View solution in original post

Highlighted
Regular Visitor

Re: Power Query importing CSV from folder error

@jborro Works like a charm! Thanks!!!

Helpful resources

Announcements
Super Users of the Quarter - Q2 2020

Super Users of the Quarter - Q2 2020

Who are our Super User Superstars? Who made it to the top of the leaderboards? Get the answers!

Community Summit Australia – Join Online!

Community Summit Australia – Join Online!

Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.