Raja.G
(Mr.RPABot)
November 4, 2022, 9:46am
1
Hi Team,
I have extract table with header, I am using data scraper it will get header and table but unwantedly coming default header(Column 0, Column 1) like that, so i want remove that particular unwanted header from data table please help me anyone for this.
Input:
Expected output:
Regards,
Raja G
ppr
(Peter Preuss)
November 4, 2022, 9:48am
2
check the different activities related to excel read/write on the addHeaders option and set it on/off as needed
Raja.G
(Mr.RPABot)
November 4, 2022, 10:01am
3
Hi @ppr ,
I don’t want excel, so im not use excel read write, i want only to get data table output only
s0biesky
(Raul)
November 4, 2022, 10:10am
4
Can you share your workflow?
ppr
(Peter Preuss)
November 4, 2022, 10:11am
5
we assumed excel as triggered by the screenshot
On datatable base you can do:
check the column names
if the auto generated names are used
then: use first row for column name renaming and remove afterwards the first row e.g. with LINQ or Remove DataRow Activity
1 Like
Raja.G
(Mr.RPABot)
November 4, 2022, 10:37am
6
Hi @supermanPunch ,
Please help me on this
Hi Team,
I have extract table with header, I am using data scraper it will get header and table but unwantedly coming default header(Column 0, Column 1) like that, so i want remove that particular unwanted header from data table please help me anyone for this.
Input:
[image]
Expected output:
[image]
Regards,
Raja G
Gokul001
(Gokul Balaji)
November 4, 2022, 10:44am
7
Hi @Raja.G
While Using the Data scrapping it self use the Column name correctly and just write the Dt in new excel.
Regards
Gokul
Hi @Raja.G ,
As already suggested by @ppr , If you need to rename the columns in a Datatable itself then we can go ahead with Renaming the columns using the First Row values. A More descriptive step is mentioned in the below post :
Hi @markosc ,
To Perform this, we actually would need some external c# or vb.net code. But If we know that the Values of a Single Row would not be the same, then We can make the first row of the Datatables as the Column Headers first. Then Remove the First row.
This way the Rows are Intact while the Header Names/Column Names are removed.
Take a Look at the below Implementation :
We get the First Row Values in the form of an Object Array.
drArray = DT.Rows(0).ItemArray.ToArray
drArray is a…
Also, Do Check on the retrieval stage itself whether we get the Column Names as it is required.
Let us know what you have tried and it’s outputs.
s0biesky
(Raul)
November 4, 2022, 10:47am
9
Change Column1 … to whatever you want
Raja.G
(Mr.RPABot)
November 4, 2022, 10:54am
10
Yes i tried i couldn’t able to get this, i can able to get only entire table
AJITH_SK
(AJITH KUMAR )
November 4, 2022, 1:29pm
11
Hi @supermanPunch , this one working fine.
I have one more queries,
Dt1 :
Column - A B C D
Empty value
Dt2 :
1st Row Value - 1 2 3 4
2 nd Row value - 5 6 7 8
My expect output:
Dt1 :
A B C D
1 2 3 4
5 6 7 8
Currently i get this output :
Dt1 :
A B C D 1 2 3 4
5 6 7 8
Pls give solution @supermanPunch , I’m using only datatable. Not using excel.
Hi @AJITH_SK ,
We would ask you to create a Separate Topic if the Requirement differs from the Initial Requirement post. However, Similar/Same approach could be applied to your case as well.
Here, We would first require to fetch the column names present in DT1. We can do so like below :
columnNames = DT1.Columns.Cast(Of DataColumn).Select(Function(x)x.ColumnName.ToString).ToArray
We could loop through the columnNames
array and update the DT2 Column names like mentioned above in post.
We could also try using For Each row
Activity and update the DT1 datatable with DT2 row values.
AJITH_SK
(AJITH KUMAR )
November 4, 2022, 5:23pm
13
Function (x) x. columnName - what value i give?
x means? @supermanPunch