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
bugsmakesmenuts
Frequent Visitor

Combine files button not combining the files the way it should be

Hello, 

 

I have a list of files whose first 16 rows are file information and blank rows, and the column header starts at the 17th row. The structure looks like the picture below. 

p1.PNG

I was trying to import these files to power BI desktop from sharepoint folder. However, after clicking the 'combine files' button, it always squeeze all the columns to a single column as the following. 

p2.PNG

However, if I change the data source to 'folder' instead of 'sharepoint', it will work as the way I need. Then I can edit the table in Transform sameple file. p3.PNG

 

Why is this happening and how to fix this issue? I really need to import the files from sharepoint. 

 

Thanks a lot!

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @bugsmakesmenuts 

 

I cannot reproduce this. When I connect to csv files stored in Sharepoint folder (Power Query SharePoint folder connector), it displays a window just like when you use folder connector. In below window, the delimiter is comma so the columns are populated as expected. 

21092301.jpg

 

Do you see a window like above? If not, check the M codes in Advanced Editor directly. After combining files, the M codes in my queries are as below. Check if Csv.Document function is used in Transform Sample File query. If not, which function is used there? You can try replacing that with Csv.Document function. Modify the variables accordingly. 

 

Sample File

let
    Source = SharePoint.Files("https://xxxxxxxxx.sharepoint.com/sites/xxxxxxxSite", [ApiVersion = 15]),
    Navigation1 = Source{0}[Content]
in
    Navigation1

 

Transform Sample File

let
    Source = Csv.Document(Parameter1,[Delimiter=",", Columns=5, Encoding=1252, QuoteStyle=QuoteStyle.None])
in
    Source

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @bugsmakesmenuts 

 

I cannot reproduce this. When I connect to csv files stored in Sharepoint folder (Power Query SharePoint folder connector), it displays a window just like when you use folder connector. In below window, the delimiter is comma so the columns are populated as expected. 

21092301.jpg

 

Do you see a window like above? If not, check the M codes in Advanced Editor directly. After combining files, the M codes in my queries are as below. Check if Csv.Document function is used in Transform Sample File query. If not, which function is used there? You can try replacing that with Csv.Document function. Modify the variables accordingly. 

 

Sample File

let
    Source = SharePoint.Files("https://xxxxxxxxx.sharepoint.com/sites/xxxxxxxSite", [ApiVersion = 15]),
    Navigation1 = Source{0}[Content]
in
    Navigation1

 

Transform Sample File

let
    Source = Csv.Document(Parameter1,[Delimiter=",", Columns=5, Encoding=1252, QuoteStyle=QuoteStyle.None])
in
    Source

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Hi @v-jingzhang,

 

Thank you very much for your answer. It direct me to the result I am looking for!

 

So when I import the data using sharepoint folder connector, It does not have the delimiter and data type detection as your picture. The default M codes for the correspondingTransform Sample File is

 

let

    Source = Table.FromColumns({Lines.FromBinary(Parameter7, null, null, 1252)})

in

    Source

 

I used your code for transform sample file and changed the parameter name and columns number. It is now working!

 

Very appreciate for your help!

 

Tina

 

bugsmakesmenuts
Frequent Visitor

I somewhat find the reason. The query editor loads the files as Text file instead of csv file, which is strange. 

 

When I click the 'combine files' button, maybe because of the strange structure of the data source file, the query editor open the files as 'Text File' which can be noticed by going to Transform  Sample File and click the 'setting' at the source step. 

p1.PNG

If I go to Sample File and at the Navigation step, double click the file on the left hand side's icon, it will add a new step 'Import CSV'. Then, go back to Transform Sample File, click the 'setting' icon at Source step, Change 'Open file as' automatic' (csv document not working here). p2.PNG

I can get a Transform Sample File loaded as the source file designed, but when I go back to the query, 

it gives an error "An error occurred in the ‘Transform File (9)’ query. Expression.Error: We cannot convert a value of type Binary to type Table.
Details:
Value=[Binary]
Type=[Type]"

 

This problem is super confusing, and if anyone can send me a link talking about how these works backend and solve the problem, I will be very appreciated. 

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.

Top Solution Authors