In a folder I have images I want to register these names in an excel what I have done is extract the paths of the images with an array of strings and use a for each to extract the name but I fell short on the way, I am new to this I would appreciate it your support
After iterating the array add the current item to the Excel by using write cell activity, use the Excel process scope inside that use the use Excel file activity give the path of the file. Inside use Excel file use the write cell activity in that activity, give the range like Excel.byfield(column name). There is a option in write cell activity called auto increment check that option to increment the row for every iteration.
If you don’t have created Excel file the use Excel file activity helps to create an Excel file and after that use insert column activity to insert the new column after that use the write cell activity.
Hope it helps!!
- Intialize counter value to 1 at ztarting of the process.
Count(datatype: Int32)=1
- In the for each loop increment the vounter value +1
Count=Count+1
- Use write cell workbook activity. Give your excel file and sheet name.
In the cell value column give
column +Count.toString
In the cell value pass the variable of the file name extracted.
Hope it helps!!
Regards,
Hi,
Build Datatable take filename as a column.
To get the files from the directory use :
Arr_1=Directory.GetFiles(“FolderPath”)
Take for each
To extract the name of the file use
Path.GetFilename(“CurrentItem”)
To get the filename without extensions use
Path.GetFileNameWithoutExtensions(“Currentitem”)
Use add datarow activity inside the for each.
Outside the foreach use write range activity
How would I avoid overwriting the information in Excel every time I run it?
Then use “Add datarow” activity and store that information in an datatable. Then use “Append range workbook” as this activity appends the data every time you run the program.
Regards,
@CRISTIAN_SUAZO_APOLINARIO
Hi,
you create a datatable contains a filename column, Under the for each use add datarow activity give the name of the filename ,in outside for each use write range activity.
Thanks