Write numbers in series 1,2,3.....4

how can we write the series numbers in the excel in rows…can anyone suggest

@lakshmi3

Can you tell me is your excel has the rows and you want to write numbers to specific column?

Thanks

Write a formula in the first cell or the intended cell to have a sequence.

You can use write cell activity to write a formula.

num - number of values in the series.
If num = 100, the rows will be filled from 1 to 100.

Excel Formula:

=SEQUENCE(num)

UiPath Activity Screenshot:

image

Regards,
Karthik Byggari

yes the 1st row should be the seriel number and the next it has many columns with the data

I TRIED THIS BUT IT DIDN’T WORKED

@lakshmi3

Use For Each row activity and declare a variable for Index property

Inside For Each row activity you can place as Assign activity and write as

dt.Rows(index).Item(“ColumnName”) = Cint(Index+1).ToString

After the For Each row activity you can keep write range activity and specify the Datatable

Also you can try as per below post

Which ever suits you

Hope this may help you

Thanks

String.Join(“,”,Enumerable.Range(1,100)) writing the sequence into one cell, seperated by Comma

Also we can use for each / Repeat Number of Times for more complex fillings

Hi @lakshmi3 ,

Here is one more solution,

  1. Read excel file using read range Actitvity
  2. Build a Datatable (ResDT) with all existing columns along with new column Serial Number
  3. Run the below linq query in assign activty
  4. Write output back to the excel

image

(From d In TestDT.AsEnumerable
Let ra=(New Object(){(testdt.Rows.IndexOf(d)+1).ToString}).Concat(d.ItemArray).ToArray
Select ResDT.Rows.Add(ra)).CopyToDataTable