Changind data in excel

Hi,

I have data table (in excel). I would like to change it to get data as in attached file.

I hope that someone knows solution. Data table.xlsx (16.6 KB)

1 Like

Hi @Krzysztof
Check this as intstartindex=dtInput.rows.indexof((From result in DtInput.Select where result(“Column0”).ToString.Contains(“MyDatatable”) select result.ToList(0)
intendindex=dtInput.rows.indexof((From result in DtInput.Select where result(“Column0”).ToString.Contains(“My OutputData”) select result.ToList(0)

print output datatable

DtInput.Select.Skip(Intindex).Take(intendindex).CopyToDatatable()

Check this

Thanks
Ashwin S

Hope these steps would help you resolve this
—use excel application scope and pass the file path as input
—inside the scope use read range activity and get the output with a variable of type datatable named outdt
—now use a BUILD DATATABLE activity and create the columns we need to be there in the output datatable which can be inserted to a excel with write range activity. So get the output with a variable of type datatable named Finaldt
—now use a for Each row loop and pass the variable outdt as input
—inside the loop use a While loop activity with condition like this
Counter < outdt.Columns.Count-1
Where Counter is a variable of type int32 with default value as 0 defined in the variable panel
—now inside the loop use a assign activity like this
In_company = row(0).Tostring
Another assign activity like this
In_columnname = outdt.columns(Counter+1).columnname
And another assign activity like this
In_str = row(Counter+1).ToString

—next use a ADD DATAROW activity where in the datatable mention as FinalDt and in the type argument mention as string and in the ArrayRow property mention like this
{In_company,In_columnname,In_str}

—while still being inside the while loop inside the for each row loop, next to this add data row activity use a assign activity like this
Counter = Counter + 1

—outside next to this while loop inside the for each row loop use a assign activity like this as a final activity inside the for each row loop
Counter = 0

Hope this would help you
Cheers @Krzysztof

2 Likes

Could you send me example file:) I would be grateful! I will be so hard to create it with my skils:)

1 Like

No worries
I m sure you can do this as it has simple activities with few logics behind and I m in travel so I m really sorry I won’t be able to send a xaml
Kindly try and let know for any queries or clarification
Cheers @Krzysztof

Ok I will try.

1 Like

Fantastic
Cheers @Krzysztof

1 Like

Hi,

I created test robot and it works! Now I have to do it in my main robot.

Thank you very much for your help - if I have any doubts, I will contact with you.

Have a nice day!

1 Like

Cheers @Krzysztof

1 Like

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