Sorting data manually can be tedious. Automate it with Google Apps Script:
Step-by-Step Guide:
- Open the Script Editor:
- Navigate to
Extensions > Apps Script
.
- Navigate to
- Write the Sorting Script:
- Run the Script:
- Save and run the
sortData
function.
- Save and run the
function sortData() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var range = sheet.getRange(1, 1, sheet.getLastRow(), sheet.getLastColumn());
range.sort({column: 1, ascending: true});
}
Explanation:
- Range Definition: Defines the range to be sorted.
- Sorting: Uses the
sort
method to sort the data by the first column in ascending order.