Store Columns to Delete in config file or string array.
Use Excel Process Scope and Iterate trough column array using For Each. Inside for each use Delete Column activity. Pass the current iterating column name and the same will be deleted from the excel file.
Other option would be Use Read range to DataTable. Do the modification and write it back to excel file.
First option is more excel native. Second option could be time consuming as we will have to take the data out from excel and write it back.
here the columns are like not in series number first i want to delete ABCD and then G to U and then W to CO and then DN to GG will this logic going to work
ok i will take to take to data table. How the modification will happen …so i have to use filter data table activity to remove all the columns which are unwanted or any other way
At position, you should be passing the Column number. Instead of storing Column names in array, you can maintain column numbers and iterate this array of integer.
Just remember, when you delete a column, your another column to be deleted’s column number will also change. So make sure you are adding the correct column numbers to array.
Write the column name in the expression you want to have in your datatable. For example, from a datatable I want to have only one column, then I will use this as:
this function is removing the duplicate data…i dont want to remove any data . i just want to delete the columns and paste that same data in the same sheet
iam attaching a sample sheet i want to remove column A C and H and write back the data on Sheet 1 , sheet 1 should have only data the columns i need Financial Sample - Copy.xlsx (53.1 KB)
The function I wrote above returns the column that you mentioned in double quotes, all other columns will be deleted except those in double-quotes. So the columns you want to keep, write them in double quotes as I write “Item”.