AppsScriptPulse

Loop delete specific rows with counter

Example table with specific rows to delete

Example table with specific rows to delete

Table with row 3 now deleted and data shifted up

Table with row 3 now deleted and data shifted up

The following Google Apps Script has been created to help with a recent difficulty I was having with deleting rows containing a specific value, where the loop was losing the row position due to the spreadsheet data all shifting up a row each time one was deleted. Some searching online suggested looping through a spreadsheet in reverse (from bottom up) to avoid the shift, but that seems more like a workaround than a direct solution …

Source: The Gift of Script: Loop delete specific rows with counter

Comments are closed.