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.
data.zip (43.5 KB)
Example file 27052021 :
output_27052021.xls (58.5 KB)
Please guide me about it.
Please try following steps to reach your goal:
new DirectoryInfo(folder_path) (Assign it to dir_info as shown below:
Loop it in for loop with the file format
Now each for loop item will give you the file name
As per your condition make sure that the file name contains the required date.
If it matches read the excel file and store it in DT
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”.
In end of the for loop, write the created DT into excel
Hope this helps .
@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
@Shubham_Varshney How to write excel keep source column width?
For Column width you can refer the following article: