How to increase row count and enter the values in EXCEL

HI All,

I have to create excel file dynamically. — ITS done
Enter the values to it from zeroth (0th) row. If it has values then get the count of it and start entering the rows from the count.
Suppose it has some 10rows then start entring from 11 row.

How shall i do it

Sonika

@Seem

Use Read Range activity to read dataTable and then find the row count like below:

Assign int rowCount = dataTableName.rows.count

And then use Write Cell to write into cell and specify range as:

If you want to write into “A” column then specify range as: “A”+(rowCount+1). Tostring and pass requried values as string to write into cell.

@lakshman
step1: I am creating an excel file ,
step2: as soon as i create the excel file gets created, i enter the values.
Once i enter the values i am closing the workbook. So that i can do the read range.

Regards,
Sonika

Hey Sonika,

use read range before write range activity…

in do scope after excel application scope , first call read range then get row count .
then use write range and enter dynamic read range in write range.

1 Like

@armamidwar

I did the readrange inside Do scope.
It gave error saying , –

This error is because i have opened the excel work book in - Open excel application scope…

Hi @Seem

You are using the wrong read range activity here. There are are two read range activities.

  1. Workbook -> Read Range - Reads the excel without opening the file
  2. Excel -> Read Range - Has to be used within Excel Application Scope activity and reads the excel while it is open.

Please use the Read range activity which is listed under the excel activities if you are going to use it within the excel application scope… Then it should be fine. The visual difference you have in these two is, in excel read range, you do not have the file path like what you have in the screenshot. And for the workbook read range, it has a property to enter the file path :slight_smile:

Hope it helps!!

1 Like

Here is the solution,

create variable row_count
assign with value - row_count=0
image

these all activities are outside the excel scope …
inside excel scope:
In write_range activity add - “col_name”+row_count.Tostring

image

Regards,
Sonika

4 Likes

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