title: Custom sorting google scripts
body: <p>I would like to ask if it is possible to sort the data sheet with one row but from a modified sort. The sorting should be</p>
  
  <ol>
  <li>Empty cells</li>
  <li>Accepted</li>
  <li>In Progress</li>
  <li>For Follow up</li>
  </ol>
  
  <p>This is the custom order we need. These options are from a dropdown on the spreadsheet. How can I do this on google scripts for google spreadsheet? Thanks in advance</p>
  
  <p>EDIT:
  Here is my code below:</p>
  
  <pre><code>var s = SpreadsheetApp.getActiveSheet();
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var currentRow = e.range.getRow();
  var archiverow = e.source.getSheetByName("Archive").getLastRow();
  Logger.log(archiverow)
  Logger.log(currentRow)
  var new_id = archiverow + currentRow
  var id = "AR-"+new_id;
  Logger.log(id);
  
  var name = e.namedValues["Your Name"];
  SendAdminSlack(e, name);
  var duedate = e.namedValues["Due Date"].toString();
  s.getRange(currentRow, 13).setValue(duedate);
  duedate = Utilities.formatDate(new Date(duedate), "GMT+8", "MMMMM dd, yyyy");
  
  var date_submitted = s.getRange(currentRow, 2).getValue().toString().split(' ');
  date_submitted = date_submitted[1] + " " +  date_submitted[2] + " " + date_submitted[3];
  date_submitted = Utilities.formatDate(new Date(date_submitted), "GMT+8", "MMMMM dd, yyyy");
  
  var sum = s.getRange(currentRow, 3).getValue();
  var description = e.namedValues["Request Description"];
  
  var ovcalendar = CalendarApp.getCalendarById(calendarId);
  
  var title = '[ADMIN REQUEST] ' + name;
  
  var caldesc = "Summary: " + sum + "\n";
  caldesc += "Due Date: " + duedate + "\n\n";
  caldesc += "Description: " + description;
  Logger.log(caldesc);
  
  var event = ovcalendar.createAllDayEvent(title, new Date(duedate), {description: caldesc});
  Logger.log(date_submitted.toString())
  s.getRange(currentRow, 14).setValue(event.getId().toString())
  s.getRange(currentRow, 1).setValue(id);
  
  var subj = "Admin Request for "+name;
  var message = "Request Id: "+id+"&lt;br&gt;";
  message += "Due Date: "+duedate+"&lt;br&gt;";
  message += "Request Summary: "+sum+"&lt;br&gt;&lt;br&gt;";
  message += "Request Description: "+description;
  
  MailApp.sendEmail({
    to: kath,
    subject: subj,
    htmlBody: message,
    noReply: true
  });
  
  s.sort(9); // I NEED TO CUSTOMIZE THIS SORT OR MAKE A NEW ONE
  </code></pre>
  
  <p>I need to sort it specifically on the order above the code.</p>