Read specific column A value and write on particular cell B1

Hi Forum Family,

Greetings…!!

I want to read specific column A values and write on particular cell B1. How to achieve it.

Thanks in advance.

test.xlsx (8.3 KB)

Hi @Majunu09
you can try with lookup datatable

Regards
Sudharsan

Hi, From my knowledge lookup range or lookup data table is just finding out the value of the particular cell to replace or update or delete. But here I am trying to read all value which is available on col A and write on Specific cell ex C1 or D5.

For the clear understanding my expected output is:

a aaabbc
a
a
b
b
c
![image 129x121](upload://4Og6Cwcxfktfz1pvmTaLnhfCMya.png)

Okay So you need to read all the rows and write that whole row on specific cell?

yes.

Okay then try this expression


String.join("",dt.DefaultView.ToTable(true, "ColumnHeader").AsEnumerable().Select(Function (a) a(0).ToString).ToArray())

You should save this as string and write the value in the specific cell

Regards
Sudharsan

I am getting this error…

Attempt1.1: Object reference not set to an instance of an object. I apply that variable on range side.

can you share a Screenshot or XAML file.

@Majunu09

Update to this expression


String.join("",dt.DefaultView.ToTable(False).AsEnumerable().Select(Function (a) a(0).ToString).ToArray())

Regards
Sudharsan

Do I need to change like dt to my data table variable?

can you explain me the code…

Yes

Regards
Sudharsan

you can use what ever column you need by changing the index in a(any index)

Regards
Sudharsan

1 Like

Hi @Sudharsan_Ka , I am getting error like string cannot convert to data table.

Error ERROR Validation Error Compiler error(s) encountered processing expression “String.Join(”",newdt.DefaultView.ToTable(False).AsEnumerable().Select( Function(a) a(0).ToString).ToArray())".
Value of type ‘String’ cannot be converted to ‘System.Data.DataTable’. Main.xaml

You are using the value to write in a particular cell with “Write cell activity” right?

if you use write it will write in the given cell

Regards
Sudharsan

@Sudharsan_Ka , I tried write cell but it throws error, Now its runs fine. Thank you. :slightly_smiling_face:

1 Like

This thread may help you,

1 Like