I want to add a letter infront of every cell

Hey everyone

I have an Excel document.

In the A column I have number like:

A
2313123123
1231232
121331312313
12121121

I want to Add the letter “D” in front of every value in the A column. so it will all be like

A
D2313123123
D1231232
D121331312313
D12121121
how can ı achieve this?
Thank you all

Do you need the bot to do this on a repetitive basis?

  • If it’s a one-time requirement, you might as well use an Excel formula.
  • For repeat requirement, if you have control over the datatable before writing to excel, you can curate the data while the table is being populated.
  • If you must read from excel and write back with updated values, then you could consider iterating through the rows and adding “D” before each string value.
1 Like

Hi,

Its a exported excel document so it comes with the values under the A column, All i need to do is update the column values. So the numbers will be in it I need to add “D” on the begining of every cell in A column.
so

A
12
3
2
4
2
will be
A(column)
D12
D3
D2
D4
D2

There have been several forum posts with the same topic. Please search with relevant keyboards so that you may get your solution quicker :slight_smile:
(Examples here, here and here)

For your task, you may follow this approach:

  1. Read Range to read worksheet into a DataTable, say dtRecords
  2. For Each Rowrow in dtRecords
    Assign → tempValue = row("A").ToString
    Assign → row("A") = "D"+tempValue
    (This will only update the data in the datatable object)
  3. Write Range to write the datatable back to the original worksheet.
2 Likes

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