Is it possible to convert the 4th row of an existing datatable a header like you would manually in Excel?
Lets assume following:
*a datatable with header names
- the values from fourth datarow should be used as column names
item = YourDataTableVar.Rows(3).ItemArray
YourDataTableVar.columns(idx).ColumnName = item.toString.trim
afterwards remove the fourth row from the datatable
Left side of assign is: columnItem.ColumnName
Right side of assign is: myDT.Rows(3)(columnNum).ToString
should i insert something in the “columnItem” part or will that just be the variable?
is “idx” a variable or that’s the position of the row?
The For Each activity creates it as a variable for you, based on whatever you put into the ForEach field.
idx is the name of the variable he’s using to give the For Each somewhere to store the Index of the current row of the loop.
not the index of the row, but the index/position of the looped column / item from the itemarray
in the itemArray we get all columnvalues from the datarow
over this we do loop and using the idx (0,1,…) representing the current loop index for updating the columnname

Do you know why it says this for each is not set to an instance of an object? It is in an Excel Application scope.
Assign = SoF.Columns(3).ColumnName = Item.ToString.Trim
SoF is the datatable name
You’ve conflated his solution with my solution.
You have the For Each set to System.Data.Datacolumn but that’s only for my solution, not PPR’s.
we do see from screenshot, that TypeArgument is set to System.Data.Da…
but we had shown different settings:
Also we had set the idx
And much more differences are to correct
Check the Variable Scope from the datatable when doing the read range and set it to a higher level
oh youre right. thank you