Dear Team,
How to delete columns in Excel file
Dear Team,
How to delete columns in Excel file
Hello dear,
You should use following code for delete excel file column
Regards and Thanks,
Yogesh Shirsath
Thanks Yogesh,but I want to delete specific columns eg. from G:AA, how to select these columns, after selection I can use the short cut key you have mentioned
Hello,
There is no method for that in uipath but you can use .net method that is available in .net framewor and you can invoke any method from .net using invoke activty, you can learn about deleting rows here
Try this and comment your outcome please.
testtt(Autosaved).xaml (9.1 KB)
Well, actually there are few workarounds.
If you’re working with an Excel Table you can directly use Delete Column
activity
Though not so obvious, there are many things you can achieve via UI Automation and shortcut keyboards.
Let’s say you want to delete column C. This sequence of activities will work: Go To C1, ALT+H, D, C
. Make sure you remove the Activate on the last two Type Activities. DeleteColumnC.xaml (8.0 KB)
Now, if you want to delete columns from G to AA you just need to repeat deleting column G 21 times.
This link will definitely help.
Lol, how about just “write value” , select the range you want and put “” on the value?? That will put it all blank. not deleted.
It works if you don’t want to bring the columns at right side to left one…
Hello. Just to propose a different method you could use the Activity Select Range and specify all sorts of values:
Then you just need to send a delete hotkey. Just remember to send the hotkey in the sheet itself.
Actually your idea helped me a lot. Thank you very much:)
Hi @beesheep
Thanks. It is deleting only one column name. I want to delete multiple column names but the arguments are not taking multiple names. Is there any other method?
Thanks,
Ula
I am able to give only one column name in invoke method activity and using remove function.
@Boopathi If you just want to Keep 9 Columns, then you can use Filter Datatable Activity and in Keep Columns Section of Filter Wizard , Mention Column Names that you want to Keep
Hey @Boopathi
You can also use DefaultView, like this:
dt = dt.DefaultView.ToTable(False, “Column1”, “Column2”, “Column3”)
In this way, in dt you will store the columns you desire.