How to add border for excel range in sheet

For eg I have data from A1:C5
I want to add border for that range in excel sheet. Can anyone please guide?

To add a border to a specific range in an Excel sheet using UiPath, you can follow these steps:

1.Use the “Excel Application Scope” activity to open your Excel file.

2.Within the scope, use the “Select Range” activity to select the range A1:C5.

3.After selecting the range, use the “Set Range Color” activity to set the border color for the selected range. You can configure the border style, thickness, and color as per your requirements.

4.Use the “Write Range” activity to save the changes to the Excel file.


Thanks for the information but for set range color activity, only color, range & sheet name options are there. Where to set thickness for border?


Can you try the following sample using ClosedXML? (11.6 KB)

Using wb As New ClosedXML.Excel.XLWorkbook(filename)
    Dim sheet As ClosedXML.Excel.IXLWorksheet = wb.Worksheet(sheetName)
        With sheet.Range(strRange).Style
    End With
End Using


tried like this for invoke code activity error is throwing like
exception is thrown by target of an invocation


Does the above sample work?
Can you share content of $exceptionDetails in Locals panel when error occurs?


Try with this UiPath custom component


Hope this helps

Cheers @vnsatyasunil

1 Like