I am expected to get 0 as output but I am getting 1 as my Output in Excel operation


I am minusing first column with 3rd column both column values are same so that I can get output as 0 but getting difference as 1

hi try to debug it by outputting column 1 and column 3 just before its doing calculation and screenshot it here
regards
ahmad

I am getting this output after running 435 rows I would take long time to debug it

just put
log activity inside the for each
counter=counter+1
log activity = counter
log activity = clumn 1
log activity =column 3

with this we can see on log which data its processing and used on the calculation

Hi @Gopikrishna_S ,

instead of for each loop cant we use excel formula to calculate the difference between first row and third row and use autofill activity to auto fill all the rows it will be very quick and will do the operation directly on excel. thanks.

How to do it

@Gopikrishna_S

Use Write cell activity and write as below expression

image

Later you can use Autofill activity and pass the range as @kirankumar.mahanthi1 suggested

Hope this will help you

Thanks

ok. please follow the below steps.

  1. Use work book read range to store the entire excel data into data table and use the following expression to calculate the row count = ouputDT.rows.count

  2. Use write cell activity to insert the formula in the sepcific column and sample formul alike =A2-C2

  3. Use auto fill range activity and use source as D2 and fill range D2:D+rowcount

Please refer the attached work flow for more guidance. thanks.

AutofillDemo.zip (9.0 KB)

did you mean log message

yes if you want to do some debug , but you can also use solution provided by @kirankumar.mahanthi1 and @Srini84

1 Like

Can we use Wook book activity instead of excel apllication Scope

Write cell and auto fill range activities will not work with out excel application scope. we have to keep these activities inside excel application scope. if you are using modern activities replace excel application scope with use excel file activity. thanks.


Error in Auto fill Range

For 435 rows it won’t take hardly more than 3-4 seconds

Fine hope the below steps with simple FIR EACH ROW activity and a write range from workbook activities will help you resolve this

  1. Use a read range activity from workbook activities and mention the file path as input and get the output as dt

  2. Now use a FOR EACH row activity and pass dt as input

  3. Inside the loop use a Assign activity like this

CurrentRow(“last_columnname”) = (Convert.ToDouble(CurrentRow(“First_columnname”).ToString) - Convert.ToDouble(CurrentRow(“third_columnname”).ToString)).ToString

  1. Then use a WRITE RANGE activity from workbook and mention the input as dt and enable add headers property

Cheers @Gopikrishna_S

Hi @Gopikrishna_S ,

Could you share your work flow.

use range like the following “J2:J”+RowCount

RowCount should be the variable to get the row count from the data table which we have got from read range activity. thanks.


Use like following “J2:J”+RowCount.tostring

Screenshot 2022-01-25 152907

it calculated values for only two rows only bro…Should I need to use for each activity to repeat for all the rows

No need to use for each row bro it is considering one row as header. In work book read range activity un check checkbox for add headers bro. it will work fine.