Forum Discussion
Get data from folder and append
- 4 years ago
Hi davidz106 ,
This can be done using a custom function in power query. You will need to create a custom function that contains your 20 line M code.
Please try to create your solution using the following steps as a guide :
1) Load all csv files from folder2) Open a blank query and create a function as shown below :
3) In the CSV query, remove extra columns. Then invoke the custom function
4) Select the custom function and the column.
What you are doing is taking each file in your staging location and feeding that as an input to your custom function using the file_path variable within the function. The output of the function is transformed data as per your M-code. The transformed data for each file will be added as a column after function invocation. Each row will have transformed data which you can then combine in additional steps.
Hope this helps.Kind regards,
Rohit
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂
Hi davidz106 ,
This can be done using a custom function in power query. You will need to create a custom function that contains your 20 line M code.
Please try to create your solution using the following steps as a guide :
1) Load all csv files from folder
2) Open a blank query and create a function as shown below :
3) In the CSV query, remove extra columns. Then invoke the custom function
4) Select the custom function and the column.
What you are doing is taking each file in your staging location and feeding that as an input to your custom function using the file_path variable within the function. The output of the function is transformed data as per your M-code. The transformed data for each file will be added as a column after function invocation. Each row will have transformed data which you can then combine in additional steps.
Hope this helps.
Kind regards,
Rohit
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂