I will be getting excel files every month in which spanish language month names will be added.
For e.g. Employee Details junio 2021.xlsx and I need to process these excel files in next month
June month file will get processed in July month.
How can I check for spanish month names from a file name in a folder?
Hi @Poonam_Yadav ,
We can Convert the Current Language Month Name to a Spanish Name using the Culture Info.
As you would need to get the Previous Month Name in Spanish, The Culture Info Code would be
We can get the Converted Month Name as below :
We can use this Code in the
Directory.GetFiles method of accessing the files as below :
Here is a List of Culture Info or Country Codes for the Culture Info :
Hey @Poonam_Yadav! Lets go to the solution!
Step 1: We are going to define a variable of type CultureInfo “culture” that will contain our Spanish culture information.
Step 2: Let’s now define the date of Today and store it in a variable of type Datetime “date_today”, this is because we are going to extract from this variable the desired month (current month -1)
Step 3: Let’s define a String array that will contain the files of interest that we are going to return.
Step 4: And finally we will have a variable of type String “str_lastMonthSpanish” that will store month-1 in Spanish in full.
Now let’s get to the code!
- Step 5: First let’s extract the name of the month in Spanish.
- Step 6: Next we will extract the files that have month-1 in Spanish in their name.
- Step 7: Checking the results.
Hope it helps!!
Main.xaml (8.9 KB)