Taking a specific format of date from excel

Hi friends,

Need some help.
I have an email attachment in the following format “12345_Open Items_yyyymmdd_DB”

The date will be the present day’s date in this particular format. i want to keep this attachment name configurable so i have added it in the config file. But i cant get the date from there. i added the above file name as 12345_Open Items_now.tostring(“yyyyMMdd”)_DB

Please help me out as to how i need to save the name in excel so that ill get the output as its desired.

Thank you


Try mentioning like this by concatenating them

“12345_Open Items_” keep this alone in excel

And once after reading the excel and getting this cell value mention like this to save the excel file with date format you want


Cheers @karan.kapoor

Store this in your config file:

  1. FileFormat = 12345_OpenItems_{0}_DB.xlsx
  2. DateFormat = yyyyMMdd

And then use this in your code:

If filename = String.Format(in_Config(“FileFormat”).ToString,Now.ToString(in_ConfigFile(“DateFormat”).ToString))