Enter data to excel in next cell

Extracted PDF text using Ocr
And entering the data into Excel file

But i need to add the next data into next cell without overwriting the previous cell

do you mean along the row or along the column

Hey @Palaniyappan just need to enter in into new row

1 Like

we can pass them as array row in ADD DATA ROW ACTIVITY
so the process sequence would be
–excel application scope
–inside the scope use read range activity and get the output with a variable of type datatable named dt
–now use a ADD DATA ROW activity where in the ARRAYROW property mention the input value like this
and in the datatable mention as dt

–once after this use a KILL PROCESS activity and mention the process name as “EXCEL” in the property panel
–now use a WRITE RANGE activity from workbook and mention the file path of the excel and input datatable as dt and enable ADD HEADERS in the property panel

Cheers @hasib08

Can we use counter ? @Palaniyappan

hmm yes ofcourse
use a WHILE loop followed by a READ RANGE ACTIVITY inside the EXCEL APPLICATION SCOPE and mention the condition like
counter < dt.Columns.Count

where counter is a variable of type int32 with default value as 0
so in the cell range of write cell mention like this

where 65 is the ascii code with value forA
so the cell range for each iteration would be
A2, B2, C2,…

Cheers @hasib08

Hello @hasib08

Yes. you can use a counter too. @Palaniyappan also mentioned a good approach for your scenario. If you still want to go by the write cell activities, Then I would suggest you to get a counter variable declared.

Then, use a loop to and place the write cell activities inside it. For the cell property, make it dynamic by introducing the counter variable to the part that holds the row number of the cell address.

Excellence is achieved through constant challenging and breaking off from your limitations. It isn’t taught or given; it begins within you. – @Lahiru.Fernando

Assign counter= 2 before excel scope and after the last write cell
Assign counter = counter + 1

And in write cell use range as “A”.+counter.tostring()

Is this correct @Palaniyappan @Lahiru.Fernando

this will go along the rows
but you are in need to go across columns right
A2, B2, C2,…

Yes but for writing in b2 it can be written as “B”+counter.tostring() @Palaniyappan
In write cell of B

yah thats fine either

so the sequence would be like
–Excel Application scope
–Read Range activity with output as dt
–WHILE activity with condition as counter < dt.Columns.Count
–first write cell with cell as “A”+counter.tostring() and sheetname and input value
–second write cell with cell as “B”+counter.tostring() and remaining inputs
–Third write cell with cell as “C”+counter.tostring() and remaining inputs.

–inside the while loop atlast use a ASSIGN activity like this counter = counter +1

hope this would help you
Cheers @hasib08

1 Like

I am just entering data into excel file
The data is extracted from pdf so the excel file is empty and the input for the excel sequence is coming from the main file i.e. pdf sequence


1 Like

please go ahead with these steps

and let know for any querie or clarification

Is it possible to use only counter
And not using read and while activity @Palaniyappan

no buddy
as we need to know the column count and till how long this counter variable should be carried out, we must use READ RANGE activity
where WHILE must be used to iterate till counter meets that datatable column total count
even we can use DO WHILE but a LOOP that iterates is required when a COUNTER is used

Cheers @hasib08

Okay I’ll try and let you know

1 Like

is this correct @Palaniyappan

1 Like

But we missed out
Read range and while loop
So the very first activity inside the e application scope should be READ RANGE ACTIVITY with output as dt
—the use WHILE loop with condition like
counter < dt.Columns.Count
Inside that allll the write cell activities and last assign activity that increments the counter

Only if we use read range we will get to know the column count
Only when we know the column count we can use counter
And only we use while loop there the last activity with counter = counter + 1 has some use

Hope this would help you
Cheers @hasib08

the columns need to start from A2 then A3 @Palaniyappan

Yah kindly follow these steps it would work

Cheers @hasib08

1 Like