- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Delete All Rows Containing Specific Text Within a Column in Google Sheets?
Google Sheets is a robust and adaptable spreadsheet programme that provides a wide range of features and capabilities to aid in managing and analysing data. Data manipulation tasks frequently include removing rows based on predetermined criteria. In this article, we'll concentrate on a single scenario: removing all rows from a column that contain a particular text.
We'll assume that you have a fundamental understanding of Google Sheets and its user interface throughout this lesson. To ensure clarity and simplicity of comprehension, we will offer step-by-step instructions along with screenshots. So let's get started and discover how to delete rows in Google Sheets that include a particular text within a column!
Delete All Rows Containing Specific Text Within a Column
Here we will first add all the script to the sheet, then run it to complete the task. So let us see a simple process to know how you can delete all rows containing specific text within a column in Google Sheets.
Step 1
Consider a Google Sheet where you have required data.
First, click on Extension and select App Script.
Extensions > App Scripts
Step 2
Then replace the code with the below code −
Code
function deleteRows() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var s = ss.getSheetByName('delete containing'); var r = s.getRange('C:C'); var v = r.getValues(); for(var i=v.length-1;i>=0;i--) if(v[0,i]=='Complete') s.deleteRow(i+1); };
In the code, “Sheet1” is the sheet name the sheet name, and “No” is the text.
Step 3
Then run the code to complete the task.
Then you will see that rows will be deleted. This is how you can delete all rows containing specific text within a column in Google Sheets.
Conclusion
In this tutorial, we have used a simple example to demonstrate how you can delete all rows containing specific text within a column in Google Sheets to highlight a particular set of data.