Type into: Indicate in Excel failed, cannot attach to document

Hello everybody, I am having problems writing cells in an excel. First of all I explain what I want to do and where I have problems: I have an excel with two tables in different sheets, in table 1: names and identifier (Column 3); in table 2: codes (Column 2) and identifier (Column 1). My program must go through all table 2 for each row from table 1 and see if they match in the identifier, if they match, it assigns in column 4 of table 1 the code that corresponds to it. To program it, I have used “Use the Excel file”, “For each row” (table1) and inside “For each row” (table2). Later on, I’ve used an if ([CurrentRow1]Column3 equal to [CurrentRow2]Column1) (to see if they match). Here appears my problem, I would like to update [CurrentRow1]Column 4 (table 1). The value would be [CurrentRow2]Column 2 (code) but I don’t know how to do it. I’ve tried using Type Into, Write Cell… I’ve even tried to set variable values, but in all of this cases when putting this activities inside “Then” (of the “If”), an error pops up.

Hi @jan.alemany

Use the two read range workbook activity to read the two sheets in the excel.
In first read range workbook give the sheet name of first sheet name, store it to dt1 and in second read range workbook give the sheet name of second sheet, store it to dt2.

Use for each row in datatable activity to iterate the dt1 inside this activity use another for each row in datatable activity to iterate the dt2.
Inside second for each take If activity in that activity write the condition which column have to be compare. In your case give like this
Currentrow1(Column3 name).equals(Currentrow2(“Column1 name”)).
In then block take an assign activity to store the value in the Column 2 in second sheet.

  • Assign → ValueVariable = Currentrow2(“Column2 name”).
    Use the write cell workbook activity to write the valuevariable in the Currentrow1(“Column4 name”)

Hope it helps!!

2 Likes

Refer the below workflow for your reference.

Note : In the Write cell workbook activity in cell field give like this Currentrow1(“Column4 name”)

Hope you understand!!

1 Like



Thx for answering but an error pops up now when setting values to variables

Drag out the Set variable value out of if condition and for loop give the variables and values there and drag an drop the Set variable activity inside If condition.

When the Ser variable activity is in if or for each condition it won’t show the + sign.

Hope helps!!

1 Like

imagen

Really appreaciate your help, still one error left in write cell and idk why

Okay you are using the write cell then give like this Excel.Sheet(“Sheetname”).byfield(“Column name”)
and check the auto increment row option.

1 Like

You are complicating the program I am uploading the image of workflow. If you are using the excel activities don’t use read range. Check the below workflow.

Please refer this image and make the changes like this. You have built complicatedly.

Hope it helps!!

1 Like

@jan.alemany

Have you done this If you are getting any error let me know.

1 Like



imagen
I’ve made the changes as you told me, but there s an error in my if condition.
Note: to distinguish between the columns of each table my columns in the table that has the names are called ColumnaX (X changes) and in the other table the columns are refered as ColumnaaX

Give like this

CurrenRow1("Columna3").equals(CurrentRow2("Columnaa1"))

You have not given the braces properly.
In the Write cell activity tick the Auto Increment row option.

1 Like

Thank you very much, everything works now :slightly_smiling_face:

Thank you @jan.alemany

If you find the solution Make mark it as solution which help to other in the Forum.

Happy Automation!!

1 Like

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