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.

When I enter data in a Google Spreadsheets cell, I would like the text to reverse itself.

For instance, I would like to put in a cell My text and get it converted to txet yM.

share|improve this question

1 Answer 1

up vote 7 down vote accepted

You will need to install and use a script to do it.

  1. In your spreadsheet, select ToolsScript GalleryInsert....
  2. Search for reverse. You should see String.reverse().
  3. Click Install, then Authorize.
  4. Close the Script Gallery.

To use the script, type =REVERSE(A1) where A1 is the cell with the text you want to reverse.


If you are using the new Google Sheets, the Script Gallery is not available. You will need to create your own custom function.

  1. Select ToolsScript editor...
  2. Select Blank project
  3. Replace the code with:

    /**
     * Reverses the input text.
     *
     * @param {string} input The text to reverse.
     * @return The input text reversed.
     * @customfunction
     */
    function REVERSE(string) {
      if (typeof string != 'string') {
        return null;
      }
      return string.split('').reverse().join('');
    }
    
  4. Save, return to your spreadsheet, and use =REVERSE(A1) as described above.

share|improve this answer

Your Answer

 
discard

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.