Hello, I am trying to read the data from my excel file into my application program but now in the application I have used the Calendar Controller. I want to select the Calendar Controller as my automation for reading the dates in my excel file into app.
To automate the selection of dates in a Calendar Controller in your application using UiPath, use the Type Into activity to input the dates from your Excel file into the Calendar Controller.
cheers…!
Can you please show some screenshots of what you are asking…you want to set dates in web app? If so try with set text or below is an approach
cheers
Hii @Muzi
- Use the “Excel Application Scope” activity to open your Excel file.
- Provide the file path and any necessary configuration options.
- Use the “Read Range” activity inside the “Excel Application Scope” to read the dates from the Excel file into a DataTable.
- Specify the range or sheet where the dates are located.
Use a “For Each Row” activity to loop through the DataTable. This will allow you to process each date one by one. - Within the “For Each Row” loop, use the “Calendar Controller” activity to interact with the date picker in your application.
- Use the “Click” activity within the “Calendar Controller” to select the date input field in your application.
- After clicking, use the “Type Into” activity to input the date value from the current row of the DataTable.
- Use variables or data manipulation activities to format the date if necessary to match the expected format in the application.
Implement error handling to deal with scenarios where the date input field in the application may not be available or the date format is not as expected. You can use Try-Catch blocks to handle exceptions gracefully.
-After selecting the date, continue with the loop to process the next date in the Excel file.
-Close the Excel file using the “Close Workbook” activity within the “Excel Application Scope”.
-Complete your automation workflow and test it with different date scenarios to ensure it works as expected.
Cheers…!
To read data from your Excel file into an application program with a Calendar Controller, use UiPath’s Set Text or Type Into activity to input the dates into the Calendar Controller within your application. You may need to use selectors to interact with the specific date fields in the Calendar Controller.
cheers…!
Hi!
I imagine that you have a textbox that is arranged in some format like yyyy/mm/dd --:–? And then when you click on the textbox it opens a calendar?
I highly suggest typing in the date and time rather than using the calendar selection - as not all web apps support selection of certain elements - for example, you might not be able to select the year and month dropdown to select the correct year - instead computer vision will select the entire calendar element - which can be frustrating.
Instead, this is what I suggest:
-
read your information from your excel file: pay attention to the format in which it is read, it may be different than what is displayed in the excel sheet. In this instance your data is read as mm/dd/yyyy.
-
use regex to split your date into months, days and years to 3 seperate variables, a month variable, day variable and year variable. Keep in mind that: Day can be 1 or 2 digits. Month can be 1 or 2 digits. Year can be only 4 digits. And since he textbox you are working with does not accept ‘/’ characters, you want to exclude those from your variables. A regex pattern I suggest using for this is “^(\d{1,2})/(\d{1,2})/(\d{4})$”. Now this regex expression has 3 parts called “groups”, the first group is (\d{1,2}) - this is month. So month is a digit that can range from 1, 2 units. The second group is (\d{1,2}) - this is day. Day is a digit that can range from 1, 2 units. The third group is (\d{4}) - this is year. Now to actually use this, you will use code. Assuming you are using Visual Basic, you can say:
year = System.Text.RegularExpressions.Regex.Match(CurrentRow.Item(“OrderDate”).ToString, “^(\d{1,2})/(\d{1,2})/(\d{4})$”).Groups(3).Value
To get months and days, just use the relevant groups discussed above. -
For time you can either set a constant hour and minute variable or make use of your current system time by using the Now object to extract/obtain it.
-
Then all you need to do once you have all these variables is to use a type into activity to type it all into your textbox.
I hope this helps!
Like @L_DV suggested, you could split the date into 3 parts and save each part as a string variable: Year, Month, and Day.
You would first need to store the full date as it is in Excel into a string variable, let’s call it FullDate. Remember it will be read in the format mm/dd/yyyy.
Next, instead of using regex you could also use the Split method to split the FullDate variable in the following way:
Year = FullDate.Split(" “c)(0).Split(”/“c)(2)
Month = FullDate.Split(” “c)(0).Split(”/“c)(0)
Day = FullDate.Split(” “c)(0).Split(”/"c)(1)
You can then use a combination of Type Into and Keyboard Shortcuts activities to type the date into the calendar in the order: (Assuming the calendar is in the format yyyy/mm/dd --:–)
Year + (right arrow key) + Month + (right arrow key) + Day + (right arrow key) + “0000”