Add a value to Excel

As an example in the above situation, JOHN is used as an example, and the name is included in the variable NameCheck.
I want to check the same name and the day in the DateCheck and put the value in the Time Check in the box. There are many names

For example,
NameCheck = JOHN
DateToDay = 13
TimeCheck = 2


Use find /replace activity to find john and then get the cell number to know the tow number

Then looks like the above are dates based on the start column and get the column name for any date you need

For example say 1 is staring from column E then use UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnIndexToColumnLetter(4+requireddate)

Here say if required date is 5 you get E if it is 7 you get G and so on

Use the row and column to write the value to required cell

Hope this helps


1 Like

Hi @wjdehdnr456

For Example

NameCheck = “JOHN” ’ The name to check
DateToDay = 13 ’ The day to check
TimeCheck = 2 ’ The value to set

For Each row in dtSchedule
If row(“NameColumn”).ToString.Equals(NameCheck)

Assuming the first date column starts at index 1 or column “B”
Adjust the column index based on where your date columns start

     dateColumn As String = (DateToDay + 1).ToString ' "+1" because of zero-based index
    If Not String.IsNullOrWhiteSpace(row(dateColumn).ToString) AndAlso CInt(row(dateColumn).ToString) = DateToDay

         Set TimeCheck value
        row("TimeCheckColumn") = TimeCheck
1 Like

I don’t know what you mean. Can you tell me more?


Suppose you have these three variables
NameCheck = “JOHN”
DateToDay = 13
TimeCheck = 2

  1. Read you Excel file - dtSchedule
  2. Use For Each row of iterating
  3. Use If condition - row(“NameColumn”).ToString.Equals(NameCheck)
  4. In the Then Section use Another If Condition - Not String.IsNullOrWhiteSpace(row(dateColumn).ToString) AndAlso CInt(row(dateColumn).ToString) = DateToDay

If true, use an Assign activity to set row("TimeCheckColumn") to TimeCheck

  • Use the “Write Cell” activity within the Then section of the second “If”.
  • For the “Write Cell” activity, you need to calculate the cell reference dynamically based on the row index within dtSchedule and the column for the TimeCheck.
  • The cell reference will be like "E" & (dtSchedule.Rows.IndexOf(row) + 2).ToString() if E is the TimeCheck column.

Hope this helps

1 Like

Hello @wjdehdnr456

Assign: NameCheck = “JOHN”
Assign: DateToDay = 13
Assign: TimeCheck = 2
If (Condition: NameCheck = “JOHN” AND DateToDay = 13 AND TimeCheck = 2)
Type Into “Time Check” with the desired value
(Optional) Log Message: “Condition met. Typing into Time Check.”
(Optional) Log Message: “Condition not met.”

Thanks & Cheers!!!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.