Create an excel file named after files in a specific folder

I have a sets of files in a folder and i must enter the name of each file in an excel sheet
I already managed to read each of the files in the folder but I need to get the names and enter each one in the excel file

Am i correct? Lets say you have files in Project\Data folder. Lets say 5 files. In one excel you want 5 sheets which names are file names? Or one excel one sheet which have 5 row?

Thanks for answering, I need the 5 names to be on one sheet (forming a column)

First of all build a dt which have one column.

image

Use an assign for get file paths. PathOfFile value will be your folder path. It returns array of string.

Then use a for each. Type argument property will be string.

image

For name without extension you can use the code in the screenshot. With extension use Path.GetFileName(item)

Then add data row to built datatable.

This is the add data row properties.

image

Then your dt is ready. You can write it!

Hope that helps.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.