How do I Append to a specific Column in an Excel Spreadsheet?

excel

#1

Hi everyone,

You use the Append Range activity to append to Column A in an Excel spreadsheet. But what if I want to Append to Column C?

Would I use the “Select Range” activity and specify “C1” and then place the “Append Range” activity right after that?

Thank you,

Mark S.


#2

The Append Range only adds a table to the bottom of the existing range starting in column A. If you want to place that column to column C, then you will need to manipulate the table where there are 2 columns infront.

One way to do this (and you can find better explanations elsewhere on the forum) is to use the Add Column to add blank columns, then change the Ordinal to 0 and 1, which will move the first column to column C as intended.

It would look something like this:

Add Data Column
Add Data Column
Invoke Method // Set Ordinal, using datatable.Column("newcolumn1") as target, and 0 as In Parameter
Invoke Method // Set Ordinal, using datatable.Column("newcolumn2") as target, and 1 as In Parameter

Alternatively, you can use 1 Invoke Method and only move the first column to index 2.

I don’t know if that’s best answer, but hope it helps.

Regards.


#3

It’s a good idea, thank you. I actually went another route. I just had the program separate my escalations by sheet instead of by column. That’s the robot’s way to track escalations so it doesn’t matter if it is on columns or sheets.

Then I have a workbook for the users that pulls those escalations out of the robot’s workbook and into the user’s. The only difference is that the user’s workbook is separated by columns. I did that with VBA Code inside of Excel. It’s on a macro button.

Anyway, that’s how I solved it. I appreciate your help!