hi ,
i have to create a new excel workbook for each day and for current day it should only needs to overwrite the content and for for next date it should create new excel with the date as name of excel sheet
Hi @jeevi_jeeva,
To get the current date you can use DateAndTime.Now, while for the next day your can use DateAndTime.Now.AddDays(1). Perhaps you should use one of these within your if condition.
For writing your excel files, you can use https://docs.uipath.com/activities/docs/read-write-and-append-data-in-excel
Best regards,
Marius
-
Use assign activity to get all the file from a folder :
File = Directory.GetFiles(path) -
Use assign activity to get the current date and time :
CurrentDateTime = System.DateTime.Now -
Use for each activity to get all the files one by one
-
Inside for each activity use assign activity to replace the file path and extension :
FileName = file.ToString.Replace(path,“”).Replace(“.xlsx”,“”) -
Use if condition activity : FileName.Contains(CurrentDateTime)
-
If the file name contains today date, will perform further activities :
-
If the file doesn’t contain today date: Use assign activity to count the files
FileCount = FileCount + 1 -
Outside the for each activity, use if condition activity :
FileCount.Equals(ExcelFiles.Length) -
If the condition satisfied then use the Create File activity to create a worksheet :
filelocation = path (You can create it anywhere you want )
filename = “Database_”+CurrentDateTime+“.xlsx” (Database_ is just string )
Hope this will you
Happy automation
Best Regards,
Vrushali