This is my sheet

As you can see row 2 and 6 are empty because I manually deleted some products. My question is how to programmatically delete those empty rows and be replaced with the other product-filled rows?
var ss = SpreadsheetApp.openById("my spreadsheet id");
var sheet = ss.getSheets()[0];
var data = sheet.getDataRange().getValues();