How to write output data in excel right next to the input row

Hello All,

i searched for invoice date in portal and store data in variable. now how can i write data in same input excel “DATE” row. ?

please help me.

Thanks in Advance!

image

If you are using a For Each Row, then would be like this in Assign activity:
row("DATE") = variableDate
And after all is done you use Write Range to write all back to excel file.

1 Like

Hello Bruno,

thanks for the response!

i used invoice as input, inside For Each Row activity then i read invoice date and stored in variable. now i need to write that value next to the Invoice (Date row).
is it possible to write invoice date after each value ?

If you are using a datarow, just add another field right next to invoice variable: {invoice, Date.Today.ToString}.

If are adding this datarow to a datatable, don’t forget to create the date field if it doesn’t already exists.

Hope this helps :slight_smile:

@Srinu6038
If I am not wrong, You are reading the invoice numbers from excel, searching for the invoice in portal and extracting the date. Now you have to write that date in the same excel where you read the invoice numbers.

  1. Use read range activity to read the Invoice numbers from excel. Output of this will be a datatable, dtTable
  2. Use for each row activity and loop through each rows(row) in the datatable.
  3. Search the invoice number in the portal and extract date
  4. Get row index, dtTable.Rows.Index(row). The result will be an integer representing the row index, intRowIndex
  5. Use write cell and specify cell value as [ColumnIndex][RowIndex] like “B” + (intRowIndex + 2).tostring
    Note: + 2 => excludes Header and the row index always starts from 0 but excel cells start from 1
    Alternatively, you can add a column into your datatable and update the value in that. But with huge data, if there any exception occurs in between, all the previously searched data will vanish and there by forcing you to redo the entire process for all records.
    Using write cell, the data will be updated real time. If there any exception, next time you can get the only records for which there is no date written and then do the search only on them.
2 Likes

Thank you for the response!!

right now i’m using below process.

  1. read range activity to read invoice numbers from excel, output as dtTable and also created another datatable for final output.
  2. used for each loop activity, searched invoice numbers in portal and store invoice date in string variable.
  3. used add data row activity inside loop to store each row in datatable.{ invoice number, output date}
  4. used write range activity outside the loop to add datatable in output excel.
    As you mentioned, if there is any exceptions occurs, i need to restart entire process for all invoice numbers. today i will try this method and let you know.

Thanks Again!!

@Madhavi

Awesome!!!

its working, i used get row index and write cell activity to update real time…

Thank you Madhavi.

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