# Convert Column in Data Table to Array

**URL:** <https://forum.uipath.com/t/convert-column-in-data-table-to-array/151191>\
**Category:** Help\
**Tags:** system, activities\
**Created:** [September 16, 2019, 7:59pm UTC](https://forum.uipath.com/t/convert-column-in-data-table-to-array/151191 "2019-09-16T19:59:18Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![automationfinance](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@automationfinance](https://forum.uipath.com/u/automationfinance)\
**Post date:** [September 16, 2019, 7:59pm UTC](https://forum.uipath.com/t/convert-column-in-data-table-to-array/151191/1 "2019-09-16T19:59:18Z")

</div>

Hello,

(From row in portfolio\_population\_csv.AsEnumerable() Select Convert.ToString(row(“Loan ID”))).ToArray()

I am using the above to convert a column in a datatable to an array of values. However, it returns System.Array{} rather than the array of values stored in the column. Please help, thank you.

---

<div class="post-metadata">

**Author:** ![Palaniyappan](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/palaniyappan/32/524095_2.png) [@Palaniyappan](https://forum.uipath.com/u/Palaniyappan)\
**Post date:** [September 16, 2019, 8:11pm UTC](https://forum.uipath.com/t/convert-column-in-data-table-to-array/151191/2 "2019-09-16T20:11:41Z")

</div>

Fine  
kindly try with this expression  
**yourdatatablename.AsEnumerable().Select(Function (a) a.Field(of string)(“yourcolumnname”).ToString).ToArray()**

Hope this would help you  
Cheers @automationfinance

---

<div class="post-metadata">

**Author:** ![debashishforyou](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/debashishforyou/32/4778_2.png) [@debashishforyou](https://forum.uipath.com/u/debashishforyou)\
**Post date:** [December 3, 2019, 5:20am UTC](https://forum.uipath.com/t/convert-column-in-data-table-to-array/151191/3 "2019-12-03T05:20:38Z")

</div>

Hi,  
I am using the below query to convert one column of my datatable to string array :

String array = (dt2.AsEnumerable().Select(Function(a) a(5).ToString)).ToArray

But I need to convert mulitple columns (3 columns from the datatable into string array) using the above query, Please help

---

<div class="post-metadata">

**Author:** ![senthil.it89](https://avatars.discourse-cdn.com/v4/letter/s/aeb1de/32.png) [@senthil.it89](https://forum.uipath.com/u/senthil.it89)\
**Post date:** [December 12, 2019, 8:21am UTC](https://forum.uipath.com/t/convert-column-in-data-table-to-array/151191/4 "2019-12-12T08:21:26Z")

</div>

hi palani ,  
i have a read an excel file from A2:A5 ![image](https://global.discourse-cdn.com/uipath/original/3X/6/9/6925e2cb400527f5785d335a80c4a0218557d414.png)  
and convert to datatable name “value” -  
i have to convert this values to list of array . iam getting this error

 ![image](https://global.discourse-cdn.com/uipath/original/3X/8/2/822b5e7b9bd59f9c933a3b3b38edac40857f0075.png)  
please help me

---

<div class="post-metadata">

**Author:** ![aman\_sheik](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/aman_sheik/32/44703_2.png) [@aman\_sheik](https://forum.uipath.com/u/aman_sheik)\
**Post date:** [December 12, 2019, 8:31am UTC](https://forum.uipath.com/t/convert-column-in-data-table-to-array/151191/5 "2019-12-12T08:31:57Z")

</div>

@senthil.it89

Hi Senthil,

I think your number variable is in array of integer. Can you please check and change.

Thanks,  
Aman

---

<div class="post-metadata">

**Author:** ![Palaniyappan](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/palaniyappan/32/524095_2.png) [@Palaniyappan](https://forum.uipath.com/u/Palaniyappan)\
**Post date:** [December 12, 2019, 8:33am UTC](https://forum.uipath.com/t/convert-column-in-data-table-to-array/151191/6 "2019-12-12T08:33:56Z")

</div>

Kindly remove the double quotes around the value in assign activity  
Cheers @senthil.it89

---

<div class="post-metadata">

**Author:** ![senthil.it89](https://avatars.discourse-cdn.com/v4/letter/s/aeb1de/32.png) [@senthil.it89](https://forum.uipath.com/u/senthil.it89)\
**Post date:** [December 12, 2019, 8:39am UTC](https://forum.uipath.com/t/convert-column-in-data-table-to-array/151191/7 "2019-12-12T08:39:42Z")

</div>

![image](https://global.discourse-cdn.com/uipath/original/3X/0/f/0f5b5551bcac78aefb16cbcf659594ba0def68ec.png) - see again it throws error

---

<div class="post-metadata">

**Author:** ![Palaniyappan](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/palaniyappan/32/524095_2.png) [@Palaniyappan](https://forum.uipath.com/u/Palaniyappan)\
**Post date:** [December 12, 2019, 9:29am UTC](https://forum.uipath.com/t/convert-column-in-data-table-to-array/151191/8 "2019-12-12T09:29:35Z")

</div>

May I know what we are trying to get out of this expression  
Because we need some slight changes in the syntax. That’s why buddy  
Cheers @senthil.it89

---

<div class="post-metadata">

**Author:** ![senthil.it89](https://avatars.discourse-cdn.com/v4/letter/s/aeb1de/32.png) [@senthil.it89](https://forum.uipath.com/u/senthil.it89)\
**Post date:** [December 12, 2019, 9:37am UTC](https://forum.uipath.com/t/convert-column-in-data-table-to-array/151191/9 "2019-12-12T09:37:08Z")

</div>

> [@Scenario for bank statement download](https://forum.uipath.com/t/scenario-for-bank-statement-download/175409):
>
> i have an excel sheet with 10 account numbers – in the bank website i have list of some 50 accounts, i have to select(checkbox) only 10 account numbers that is matching with excel, help me with the coding.

please find this , and help me out. i have a take an input from excel sheet and pass to onepopup window in website and if matches i have to do check box selection.

---

<div class="post-metadata">

**Author:** ![senthil.it89](https://avatars.discourse-cdn.com/v4/letter/s/aeb1de/32.png) [@senthil.it89](https://forum.uipath.com/u/senthil.it89)\
**Post date:** [December 12, 2019, 2:04pm UTC](https://forum.uipath.com/t/convert-column-in-data-table-to-array/151191/10 "2019-12-12T14:04:06Z")

</div>

palani if possible share me num we will discuss on live projects a lot.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [April 5, 2020, 2:42pm UTC](https://forum.uipath.com/t/convert-column-in-data-table-to-array/151191/11 "2020-04-05T14:42:07Z")

</div>

Closed on April 5, 2020, 2:42pm UTC

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