How to delete rows from Excel?

Hi, i need to use a similar script however I’m having difficulties, I’m trying to delete all rows in Excel and move it up that does not contain a certain word in column E. If Column E does not contain the word “Transfer” then it should be deleted and the row should be moved up.

Your help will be much appreciated!:slight_smile:
example : image

Hi @trisha.
I think you can just add some variable, read value from column E for each row in loop and then check in If-Else block whether this variable contains necessary word or not. If yes, delete row, in other case, do what you need.
Also can be another option: to use While loop and check whether Excel row contains necessary word. If contains, remove row and move up rows below. If it doesn’t contain, increase row number and move further. Please see small example:

1 Like

@trisha in addition to Valeria’s solution above, you can also try reading the data in a table, and then iterate through it and check if cell 5 is empty or not. (997 Bytes)

1 Like

Is it possible to delete more than one column at the same time.image .
In this screen shot i want to delete those column whose contain only 0 ,here the column is ‘AD’, ‘AG’ , and ‘AJ’ , So is it possible to delete those column.

At the same time - no, but you can use a loop and delete the columns one by one.

how, can you tell me please.

Basically, you need to read the data to a table and check each cell in each column:

  • if the value of the cell is empty or equals 0 - do some action, like assigning a certain value to a variable ( in the example below I wrote yes to a string variable)
  • if the value is not empty and doesn’t equal 0 - do some other actions

Here is a sample script that you can change for your use case. (1.2 KB)

Thank you.
I have one more problem .
In a excel sheet i have get the data from web from day one to day 19 from those data i want to delete 16,17,18,19 date data can you tell me the solution how i do .

i want to save the data up to date 15 remaning date data i need to delete .
how i do that please tell me .
thank you…

Before checking if the columns are empty, you can use another IF condition to check if the first cell in the column equals or smaller than 05/15/2019.
If it is - append the column to a new table, if it not - do nothing.
And then check the conditions above on the new table.

Ok, i will try…

1 Like

i am not able to do that ,actually i want to save the data from 05/01/2019 to 05/15/2019. and if the date is equal to from 1 to 15 then i want to save same column with 2 right columns also.
Like this if it is 05/15/2019 then i need to save the data as above.

Hi ashapkina ,
In my excel sheet some data is there so i want to calculate the sum of those data and set the result in a cell.

for example in the above screen shot some cell data color is red so i want to calculate the sum of those data and set the result in ‘AH3’ cell , like in this way i want to calculate the sum of all rows and set the result in respective cell. How i do that please tell me.
Thank you…

@Jitendriya you can use mouse clicks on object selectors in your script so the bot will work with the file just like a person does and opens the file on the screen to automate it.

In between my script how i used object recording , when i click replace with new recording the existing code is deleted.

Can you send me any example which one help to me.

Use the “Insert recording” option, not “Replace with new recording”.

But how i calculate the sum using mouse click, for calculate the sum there is a function in excel.

Hi ashaplina
In my excel sheet i want to put zero ‘0’ on blank cell how i do that can you tell me.

Thank you.

please tell me how i do that .

You can read the Excel file in a table, rewrite the values in the table using this custom acript and then paste the table back in Excel.

here is a sample script (990 Bytes)

Thank you so much ashapkina .