Hi all,
I want to save an excel file with current date and time in a folder. How can I do it.
I know its very simple but please help me.
Thanks in advance
Hi all,
I want to save an excel file with current date and time in a folder. How can I do it.
I know its very simple but please help me.
Thanks in advance
what is the format of date time you require?
just add now.tostring(“ddMMyyyy_hhmmss”) to your file path
format ddMMyyyy_hhmmss you can change on your requirement
so finally the path should something like this “initialpath”+now.tostring(“ddMMyyyy_hhmmss”)+“.xlsx”
or you can use this way as well System.io.path.Combine(FilePath,now.tostring("ddMMyyyy_hhmmss")+".xlsx")
Hope this helps
Regards
my path is "D:\ABD"+"Output"+"Data" inside this data folder i want to save the file with date and time
23-05-2023 13:08 i want in this format but I am getting error
your file path+“_”+datetime.now.tostring+“.xlsx”
Yes You cant create a folder or file name with the colon on it
File or folder name should not contains these symbols
You can use it without colon “:”, try like this
"D:\ABD\Output\Data\"+DateTime.now.ToString("dd-MM-yyyy_HH_mm")
Try like this
Regards
Sudharsan
what is Output here?
is it any variable?
Regards
Output is a folder
try this
"D:\ABD\Output\Data\"+DateTime.now.ToString("dd-MM-yyyy_HH-mm")+".xlsx"
some of the special characters are not allowed to use in path
Regards
You should create a variable called as
SavedFilePath=“Data\Output\SomeText”+Now.toString(“ddMMyyyyhhmmss”)+“.xlsx”
Making sure that your path till Data and Output, or the folder structure is already present and accounted for.
Now you can use this SavedFilePath Variable in your code in the future.
Thanks,
Happy Automation!
Thank you all