---
title: "Sort by Random &#8211; How to Randomize the Order of Rows in Google Sheets &#8211; Digital Inspiration"
author: "Martin Hawksey"
date: 2021-07-22T21:49:35+00:00
modified: 2021-07-22T21:49:41+00:00
canonical_url: https://pulse.appsscript.info/p/2021/07/sort-by-random-how-to-randomize-the-order-of-rows-in-google-sheets-digital-inspiration/
markdown_url: https://pulse.appsscript.info/p/2021/07/sort-by-random-how-to-randomize-the-order-of-rows-in-google-sheets-digital-inspiration.md
categories:
  - "Beginner"
  - "Sheets"
  - "Snippet"
  - "Solutions"
  - "V8"
tags:
  - "@labnol"
  - "labnol.org"
featured_image: https://pulse.appsscript.info/files/2021/07/sort-random-sheets.gif
description: "Nice little snippet from Amit Agarwal which includes some Google Apps Script code for randomising the order of rows in Google Sheets. The code has some clever use of .autoFillToNeighbor(), .offset() and .sort()."
---

# Sort by Random &#8211; How to Randomize the Order of Rows in Google Sheets &#8211; Digital Inspiration

![Sort by Random &#8211; How to Randomize the Order of Rows in Google Sheets &#8211; Digital Inspiration](https://pulse.appsscript.info/files/2021/07/sort-random-sheets.gif)

[![](https://pulse.appsscript.info/files/2021/07/sort-random-sheets.gif)](https://www.labnol.org/random-sort-sheet-rows-210714)

> Learn how to sort your data in a Google Sheet in randomized order using Excel formulas and Google Apps Script.

Nice little snippet from Amit Agarwal which includes some Google Apps Script code for randomising the order of rows in Google Sheets. The code has some clever use of `.autoFillToNeighbor()`, `.offset()` and `.sort()`.

Source: *[Sort by Random – How to Randomize the Order of Rows in Google Sheets – Digital Inspiration*](https://www.labnol.org/random-sort-sheet-rows-210714)

---

*Published by [Martin Hawksey](https://pulse.appsscript.info/p/author/admin/) on [Pulse](https://pulse.appsscript.info/). Original article: [https://pulse.appsscript.info/p/2021/07/sort-by-random-how-to-randomize-the-order-of-rows-in-google-sheets-digital-inspiration/](https://pulse.appsscript.info/p/2021/07/sort-by-random-how-to-randomize-the-order-of-rows-in-google-sheets-digital-inspiration/)*
