How to write Value from specific column

Hello,
I have a one excel and in excel i have some columns (“Login Type” “Site” “TL” “Daywise” “Widget” “Kapture Tagging”).

In “Login type” column have 2 type of data (“Widget” & “Elision”). so i want if in “Login type” column found “Widget” then bot write “1” in “Widget” column and if found “Elision” then bot drop as a blank in “Widget” column.

How to write “1” value in “Widget” column. please help

@Mohammed_sahil Hi Aslam o Alaikum

Hi Walykum assalam

@Mohammed_sahil wait I am finding your solution

@Mohammed_sahil
example.xaml (13.9 KB)
here is example but I have no excel file from your end so I am giving example.
please try this, if you face any issue I am here

no its not working
This is my excel snapshot if in Login column get “Widget” need to write “1” in Widget Column and if found “Elision” then skip.

image

@Mohammed_sahil please give me excel.

It’s confidential so not able to share. just sent you dummy snapshot of orignal file.

@Mohammed_sahil please place just headers and place 2 lines …here I can’t make new one even I can’t copy from image. Its time taking

@Mohammed_sahil leave I am trying

@Mohammed_sahil
please check this
Transaction.xlsx (8.4 KB)
UpdateColumn.xaml (8.4 KB)
please mark solution and give me vote. Its a kind favor

Hi,

Try This Linq query method:

(From R1 In DT_Input.AsEnumerable()
Let validate_Col1 = If(Not String.IsNullOrEmpty(R1("Login Type").ToString),If(R1("Login Type").ToString.Equals("Widget"),"1",Nothing),Nothing)
Select DT_Result.Rows.Add({R1(0).ToString,R1(1).ToString,validate_Col1})).Copytodatatable

Sample xaml is attached
writeSpecificColumn.xaml (8.3 KB)

Thanks,
Muthuraj

Very simple method, would be an excel application scope. Inside add a read range. Have it read your table and output to datatable.

Put your datatable into a for each row loop. Loop through the column “login type” with Assign inside loop:

Assign activty like this: currentrow.item(“Widget”) = if(currentrow.item(“Login type”).tostring=“Widget”,1,Nothing)

This will set widget to 1, if the corresponding cell in Login type = widget. If not, it will leave it blank.

When your are done interating through the datatable, write it back to excel with write range.

Hello @Mohammed_sahil ,

Have a look on this video here you will get to know how to update the one column based on other column.

Thanks,
Sanjit

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