Google-sheets – How to reverse text on Google Spreadsheets

google sheetstext;

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.

Best Answer

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.