I catch an unsorted range from a spreadsheet to create a ListItem in google forms. I want this list item to be sorted alphabetically but once I get the range, if I use range.sort() it also sorts the data on the spreadsheet. Any suggestions on how to sort the values but not the spreadsheet?
So far I have this code:
//Import Clients List
var sheetClients = ss.getSheetByName("Clients");
var range = sheetClients.getRange(1, 1, sheetClients.getLastRow());
range.sort(1);
var values = range.getValues();
var item = formulari.addListItem();
item.setTitle("Client");
item.setChoiceValues(values);
Thanks.