Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

Is there an easy way to reverse the order of selected rows? (Or how about all rows, if that's easier.)

Specifically, in this case, there is no column that could be used for sorting to get them in right order. So, given a bunch of rows in an arbitrary order, is it possible to reverse that order?

As an example...

enter image description here

...after reversal of these 5 rows, "Waitrose 756" should come first and "Moot" last.

share|improve this question

1 Answer 1

up vote 9 down vote accepted

To reverse the order of the selected range (as opposed to sorting by a specific column), you could use the following script:

function reverseOrder()
  var range = SpreadsheetApp.getActiveRange();
  var values = range.getValues();

Adding this onOpen script will create a menu item called Extra, containing an item called Reverse:

function onOpen ()
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var menu = [{name: "Reverse", functionName: "reverseOrder"}];
  ss.addMenu("Extra", menu);
share|improve this answer
Thanks. It took me a moment to figure out how to add these so that the menu item appears (Tools -> Script manager...), but once I got that done, it does work! –  Jonik Jul 4 '13 at 13:48
@AdamL, How can we do this without scripting? –  Pacerier Aug 21 at 11:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.