Hello,
I have a data table and I need to add a column with a header to column N which I believe is also column 13. It’s not working. What am I missing? Please see the images
Thank you
Hello,
I have a data table and I need to add a column with a header to column N which I believe is also column 13. It’s not working. What am I missing? Please see the images
Thank you
HI @mworth123
Few changes I would like to have is:
So, when you say its not working, what does happen when you run this? do you get any errors or do you get a different output than what we expect?
After you use read range and add column, you will need to use write range so those changes are saved in your excel file…
@bcorrea - Thank you, I am using a Save Workbook activity after the add Data Columns activity. Shouldn’t that save it?
data table is a memory object, it has no relation to the excel file…
@Lahiru.Fernando - Thank you, I’ve removed the “?” from the column name and changed the type to String. I’m not getting any error messages. It just isn’t adding the column.
Question: Where do I tell it to create the column in column N? I had 13 in the Default Value field but that doesn’t seem right.
you need to make changes to your data table BEFORE you use write range, or it will not reflect in the excel file…
if you want to INSERT a column at a desired position, then you can use Add Data Columns, you will need some code like this:
dt.Columns.Add("Column Name", GetType(String)).SetOrdinal(11)
well as @bcorrea mentioned you can do this
you can use Assign activity like this
dataColumnVar = dt.Columns.Add(“Column Name”, GetType(String)).SetOrdinal(11)
cheers
@mworth123
that wont work because setordinal is not a function it is a method and wont return anything…