Combine excel multiple file?

It I want combine file excel follow date after _ data ( _27052021 3 file —> 1 file , _28052021 3 file )


From Example : I have file name _27052021 3 file —> I want output 3 sheet but 1 file and keep source column width. (43.5 KB)

Example file 27052021 :
output_27052021.xls (58.5 KB)

Please guide me about it.

Hi @fairymemay,

Please try following steps to reach your goal:

  1. new DirectoryInfo(folder_path) (Assign it to dir_info as shown below:

  2. Loop it in for loop with the file format

  3. Now each for loop item will give you the file name

  4. As per your condition make sure that the file name contains the required date.

  5. If it matches read the excel file and store it in DT

  6. Now move to next row item and if it again matches the condition, read the file again and then merge the file with “merge DT”.

  7. In end of the for loop, write the created DT into excel

Hope this helps . :beers:


@Shubham_Varshney How​ to​ match​ file​ name​(same​ date) and​ write​ keep​ source column​ width?

from the 3rd step, you will get the file name of all the files in the folder.
You can compare that against your requirement.

If you are good with the solution, please mark it as solution :slight_smile:

@Shubham_Varshney How​ to​ write​ excel​ keep​ source column​ width?

For Column width you can refer the following article:

1 Like