Write specific cell with row index and column name

image
Based on above image, I want to write cell on Cell B4. How to write this specific cell with the column name “ST” and the row index.

I need to use write cell directly without using any for each loop.

@JackyLeung123

Read the Excel sheet and store it in Variable.

Assign: Set cellValue to the value you want to write (e.g:YourValue).

Write cellValue to cell “ST4 or B4”.

Write Range Save the modified DataTable.

image
Can you give me more details on how should I type in the (Where to write) part??

Hi @JackyLeung123

Try with this expression @JackyLeung123

Excel.Sheet("sheetname").Cell("B4")

Use cell number in Where to write

Excel.Sheet("sheetname").Cell("B4")

Maybe there is some misunderstanding.

I want to find the cell with row index and column name instead of “B4”
Here is the example
image
However, this wrong valuable type to use. How to write the cell with row index and column name are provided??

Hello @JackyLeung123
Try this by using simply Assign activity if you are using Modern activity.

Excel.Sheet("Temp").Cell("B4")= "kkk"

Update the sheetname as per the name of the sheet Temp

Check out this image for the Reference @JackyLeung123

In my case, I do not know it is B4. The only information that I know is the row index and column name.

This method is not work for me

The case is that I do not know the cell number. The only information I know are row index and column name. How to write the specific cell without cell number??

I do not have the cell number in my real case. How to write the specific cell without cell number? But I have the information of row index and column name.

@JackyLeung123
Try this

  • Use the Find and Replace activity and search the header “ST” —> Output = B1
    image

  • From this, you can get the Colum address and use the Regex to separate the Alphabet
    use assign activity

FindColumn=System.Text.RegularExpressions.Regex.Match(FindCell,"\D+").tostring.Trim    ---->Output = B
  • if you have row index of 4 then use Writecell activity, cell address is FindColumn+Rowindex
Excel.Sheet("Temp").Cell(FindColumn+Rowindex)

Hi @JackyLeung123 ,

I believe it is more of finding the Excel Column Letter, so we could use the below Expression to get the Column Letter from the Column Index (If already a Datatable is being read) :

columnLetter = UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnIndexToColumnLetter(DT.Columns.IndexOf("ST")+1)

Let us know if it does not work