Google Scripts Guide to Clearing Data

Clear ranges with Google Scripts.

This came up in a recent project of mine from a client, specifically they needed to clear a range, while keeping the formulas and formatting. The goal is to just clear values within the range. While solving their issue below lets look at how we got there. To begin with we need to get a range to play with.

  1. Get a range
let range = mySheet.getRange("A1:B8")

2. Clear