Forum Discussion
How to add a new column with file source name
- 4 years ago
Hi Anonymous ,
1. If you are connecting to these excel files directly, then you may have to use parameters to enter the path of the excel files. As shown below, create parameters for each excel files, and the parameter value is the path to the corresponding excel file, which can then be referenced in the data source to import the excel table.
Source = Excel.Workbook(File.Contents(#"Excel1 path"), null, true)Source = Excel.Workbook(File.Contents(#"Excel2 path"), null, true)Then create the following custom columns for each table, i.e. the column value is equal to the parameter value. Then split the column to get the file name.
2. A simpler way is to put all excel files in the same folder and then use the Folder connector, which will include the name and path of each excel file.
If the excel files you want to append have the same structure, then you can just click on "Combine Files" and you will get the following result.
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
This is the result of directly append queries.
You can try adding custom columns to add the paths to each table, or you can also refer to this video to create your functions.
= Table.Combine({Table.AddColumn(#"Changed Type","FileName",each "Table A"), Table.AddColumn(#"Table B","FileName",each "Table B")})
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous4 years agoNot applicable
HI, thanks for your response, but it is not usefull
as i need the filename ( excell file name) into a custom column
Thanks