Wants too add data columns which are extracting from .toarray

Wants too add data columns which are extracting from .toarray

Hi @Shubham4323 ,

Could you provide us some more details as to what you want to perform ?

Hi @Shubham4323

Can you give us more detail regarding you query.

Based on my understanding ->You have an array and need to add the array in the Add Data Column activity Right?

If yes, Then follow the below things

  1. Use Assign activity
LHS = arrValues -> Variable Type | Array of string
RHS = {"Test","Test1","Test2"}

image

  1. Use For each activity
For Each           In
  currentItem      arrValues
  1. Use Add Data Column activity

image

Regards
Gokul

@buddy @Gokul001 i tried this in my case if i tried Output Data Tabble before write Range. In that it’s printing the values then i applied Write Range Worbook out of loop with header checked, nothing is updated, it showing null excel file.

@buddy @supermanPunch In my case, I tried Linq Query and converting data into .array then in my case I want string array values to be Excel Headers. I tried after converting data to array.

I tried loop string array variable as loop string adding “add data column” then after that write range but none value is updated there.

@Shubham4323 ,

Could you show us the Implementation that you have done ? Screenshots of it would be fine.

Also Maybe Perform a Debug and Check at what point is the Data not getting converted as required.

image
Here is Build Data Table which should be blank.


Here I creates the Array[string] ={“name”,“salary”}
image
Then For each with the CurrentItem adding data column.
image
then data to be in Excel Write range with Add Headers Checked.

@Shubham4323 ,

After Performing the Addition of Data Columns, Before the Write Range Activity Use Add Data Row Activity to add an Empty row like below and Check whether you’re able to get the Output as Required.
image

@supermanPunch Yeah after adding “data Row” and it’s random values, it’s able to give the result with Header values but In response of adding data column it’s unable to give only headings.

Just create a DataTable variable and set the following Default value: New DataTable

After that you can do what you want to do using different ways.
For example For Each (for the Array) with Add DataColumn activity
Or also using LINQ query:

(
From c in YourArray
Let x = YourDataTable.Columns.Add(c,GetType(String))
Select c
).ToArray