Make Entry in the excel

Hi, I want to write the status in the excel after done sone operation. so do I need to use the excel scope, read range activity or directly I give use a Write Range Activity and give the particular excel name and the column name where I have to write the status is enough. Right me If I am wrong.
[ If criteria are fulfilled then I want to write in the Status column is Yes/No ]
Please guide me.
@Palaniyappan @lakshman

1 Like

Fine
–use a excel application scope and pass the file path as input
–use read range activity and get the output with a variable of type datatable named outdt
–use a for each row loop and pass the above variable as input
–inside the for each row loop use write cell activity and mention the value like “Yes” and in range mention like this, if we want to update in column C then
"C"+Counter.ToString
where Counter is a variable of type int32 with default value as 2 (inorder to write from C2, as C1 will be a header)
next to this use a assign activity and mention like this
Counter = Counter + 1

Cheers @balkishan

1 Like

@balkishan

Read index of the cell and then use Write Cell Activity and pass that index to write into that cell.

To read index of the cell:

dataTableName.Rows.IndexOf(row)

Note: The above expression should be used inside For Each Row

2 Likes

I have a foreach loop but not for excel bro this for each for PDF Reading operation. And here I am not reading any excel, I have a another excel there I want to write in a Status cell Yes/No.

Are you there @Palaniyappan and @lakshman

Write Cell Activity Error.

Why it’s showing me need to use under Excel App Scope.
As I already using inside the Loop. ???
@lakshman and @Palaniyappan @ImPratham45

1 Like

use write cell within excel applicaiton scope buddy
and mention the range as “Columnname”+Counter.ToString
if A is the column
then
"A"+Counter.ToString
–then next to this write cell acivity use a assign activity like this
Counter = Counter + 1
where Counter is a variable of type int32 with default value 2
@balkishan
Cheers

1 Like

so bro you said we need to use Loop also???
Then how we’ll increment the counter value? If I used this in the Excel Application Scope?

yes inside for each row loop the sequence should be like this
–For each row loop
–excel application scope
–write cell
–assign activity
@balkishan

1 Like

kindly Try and let know buddy
@balkishan

Bro As I know.

  1. we need to use a Excel Application Scope
  2. Inside it use Read Range and create a DataType Variable
  3. Then use Loop and pass the DataType variable inside.

But As you said first Loop then excel application scope before excel app scope and read range how can we use this?

I passed the DT var in a Loop after using the Excel Scope and Read Range.

If I use first Loop then we need a var to pass it, right me if I am wrong.

you’re saying Two Loops bro. So before using the Excel Scope and Read Range how can we use the loop, I need a DataType variable which we’ll create to store the Read Range Activity. That we need to pass into the Loop. Right ? But If I will use first Row loop then how I pass this ???

sorry bro didn’t get this?

@balkishan

           ForEach row in DT
               Int32 index = DT.rows.IndexOf(row) +2

Use Write Cell Activity and pass below

Want to write in C cell then
range as: “C”+index.Tostring
Value: status either yes or no.

1 Like

you want me to use here bro inside the loop.

ForEach row in DT -------- I understand this step

Int32 index = DT.rows.IndexOf(row) +2

so Index is Int variable right?
So what is row inside the brakcets?

everything is okay, but it showing write cell should be inside the Application Scope Activity???

@lakshman

@balkishan

Yes you should use everything inside the Excel Application Scope Activity only.

1 Like

Thanks bro @lakshman @Palaniyappan resolved.

1 Like

Hi @lakshman It’s working fine can you please tell me will your index work like a counter ???
So here I want to start from E3 then how?

1 Like

@balkishan

Yes it will work.

DT.rows.IndexOf(row)+3

It will increment one by one. No need to use any counter variable here.

2 Likes