How to remove columns from excel (old solutions unable to be opened sorry!)

I am doing an automation where I have 5-10 rows in excel and up to 50 dates which is a mixture of filled and unfilled cells in the columns. I am trying to copy and paste the dates into a website.

So far what I am thinking is:

  1. to somehow read one row at a time
  2. try to remove the empty columns
  3. then use a do while loop and loop until I insert each date into the website.

Is there a way to remove the empty columns? I couldn’t use the filter function since it mainly works on rows. Thank you so much in advance!

You can just use an If in your loop. If the current column value is not blank, enter the date…otherwise do nothing. Then it’ll just skip the blank values as it’s entering the dates.

Hi Kidd,
I hope you are well.
Please, follow the next steps:

  1. Use the ‘Read Range Workbook’ activity to extract the DataTable.
  2. Use the ‘Filter Data Table’ activity and then configure the filter.
  3. Use the ‘For Each Row in Data table’ activity.
    image

Hope this helps :+1:

@kidd

Follow this to remove all empty columms

  1. For loop with dt.Columns
  2. Inside loop use filter datatable on dt and output into filtereddt and in condition use currentitem.ColumnName and select is empty
  3. Now use if condition filtereddt.Rowcount=0
  4. On then side use remove data column and give the column name as currentitem.ColumnName and datatable as dt

This will delete all columns in which all rows are empty

Cheers

@kidd

You can use the below representation:

Excel Application Scope
├── Read Range
├── For Each Row
│ └── For Each
│ ├── If
│ │ └── Filter DataTable
│ └── Remove Data Column (if cell is empty)
└── Write Range

Happy Automation

Thank you everyone so much! I really appreciated everyone’s help!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.