I want to create a new folder automatically when I write into excel. That excel should be there in new folder with current date and time. So it becomes easy to identify. How should I do it can someone show with screen shot or an example.
Thankyou
I want to create a new folder automatically when I write into excel. That excel should be there in new folder with current date and time. So it becomes easy to identify. How should I do it can someone show with screen shot or an example.
Thankyou
Hi @Bhushan_Nagaonkar ,
You could try using the Create Folder
Activity with the Expression of current date and time like below :
FolderPath
assign the value like below :FolderPath = Path.Combine(Environment.CurrentDirectory,Now.ToString("dd_MM_yy_HH_mm_ss"))
Next use the Create Folder
activity with the above variable as the value.
When writing the data to Excel file mention the path like below.
Path.Combine(FolderPath,"yourExcelFilePathName.xlsx")
Visuals :
Let us know if this is not what was expected.
Thanks I will let you know asap
Apologies. A bracket is again needed to be added at the end. I have updated the expression in the post above.
I have already updated the bracket the error is combine and now are not part of the string
“Now” is fixed but still got an issue for “Combine”
Change the variable name to FolderPath
, if you could observe in my earlier post, Path
is different and FolderPath
is different.
Path
is a reserved word like System
, hence we cannot use it as a variable.
From NewFolder to FolderPath or from Path
Ok I got it now
Still same
No change in error
I have deleted it. I will share a screen shot
Folder Path
in place of Path
Yes. The datatype should be string.
However, there is a lot of confusion. Do change it to string and if there are any further conflicts, Try to do the steps mentioned in the post above from the Start. Else we could provide a xaml.
Thanks it really worked. I did the changes. One more question can I save this in the folder I want
Yes. In that case, you would require to modify the FolderPath
or NewFolder
variable value assignment in the below way :
Path.Combine("YourFolderPath",Now.ToString("dd_MM_yy_HH_mm_ss"))
Notice that, previously I had used Environment.CurrentDirectory
to create the Folder in the project’s directory.