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
admin11
Memorable Member
Memorable Member

How to load only 1 CSV file By modify the script ?

Hi All

 

I have load 4 CSV file to sharepoint folder. The script as below :-

 

let
Source = SharePoint.Files("https://isdnholdings.sharepoint.com/sites/FTGL/", [ApiVersion = 15]),
#"Filtered Hidden Files1" = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true),
#"Invoke Custom Function1" = Table.AddColumn(#"Filtered Hidden Files1", "Transform File", each #"Transform File"([Content])),
#"Renamed Columns1" = Table.RenameColumns(#"Invoke Custom Function1", {"Name", "Source.Name"}),
#"Removed Other Columns1" = Table.SelectColumns(#"Renamed Columns1", {"Source.Name", "Transform File"}),
#"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File", Table.ColumnNames(#"Transform File"(#"Sample File"))),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Source.Name", type text}, {"GL Code", Int64.Type}, {"GL Description", type text}, {"Type", type text}, {"Month", Int64.Type}, {"Year", Int64.Type}, {"Posting Date", type date}, {"AccCur", type any}, {"AccConvRate", Int64.Type}, {"C/D", type number}, {"CurrencyValue", Int64.Type}, {"Reporting Code", Int64.Type}, {"Date", type date}})
in
#"Changed Type"

 

My question is , how to modify the above script , so that it will only load 1 CSV file instead now load 4 CSV file.

 

admin11_0-1641006823761.png

 

The reasons is , i try to create sample PBI file , so that it can load faster , until i tested okay , then i load all raw data file. My actual raw data file have more then 100.

 

Paul Yeo

1 ACCEPTED SOLUTION
aj1973
Community Champion
Community Champion

@admin11 

You have 2 ways to do this

1st Way- Re import your Folder from Sharepoint and do not click on "Combine" data since you only need 1 table ,

aj1973_0-1641081202289.png you will get this in Power Query

aj1973_1-1641081314461.png

Click on Binary of the File you want to keep and then Table

aj1973_2-1641081422200.png

you will be set

 

2nd way is: since you already combined the 4 files then go to this step

aj1973_3-1641081602351.png

Click on Binary and then Table (Like i explained on the 1st way) , then click on "Continue"and you will be all set.

 

 

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

View solution in original post

6 REPLIES 6
AlexisOlson
Super User
Super User

You can insert a step after #"Filter Hidden Files1" to select just the top row or modify the code to add.

 

#"Filtered Hidden Files1" = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true){0},

 

This returns the index 0 (first) row of the table.

@AlexisOlson 

Thank you and happy new year to you. 

After i insert {0} 

admin11_0-1641010508030.png

I get error msg :-

admin11_2-1641010569277.png

I unable to clear the error.

 

Paul

aj1973
Community Champion
Community Champion

Hi @admin11 

Delete these steps and re do them again if you need them.

aj1973_0-1641067642632.png

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

@aj1973 

Thank you for sharing

But my issue is , when i add script {0} , i get below error.

admin11_0-1641078851923.png

 

aj1973
Community Champion
Community Champion

@admin11 

You have 2 ways to do this

1st Way- Re import your Folder from Sharepoint and do not click on "Combine" data since you only need 1 table ,

aj1973_0-1641081202289.png you will get this in Power Query

aj1973_1-1641081314461.png

Click on Binary of the File you want to keep and then Table

aj1973_2-1641081422200.png

you will be set

 

2nd way is: since you already combined the 4 files then go to this step

aj1973_3-1641081602351.png

Click on Binary and then Table (Like i explained on the 1st way) , then click on "Continue"and you will be all set.

 

 

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

@aj1973 

Thank you very much for your good effort.

Paul

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.