Image Resizer formula

Image resizing is an important aspect of image processing in web applications, and Google Apps Script offers a custom formula for resizing images in Google Sheets.

Here is the custom formula code for an Image Resizer in Google Sheets using Apps Script:

function resizeImage(url, width, height) {
  var imageUrl = url.replace(/(s[\d]+)/, "s" + width + "-c" + "-h" + height);
  return imageUrl;


This function takes in three parameters: the URL of the image, the desired width, and the desired height. It then replaces the current size parameter in the image URL with the new width and height parameters to resize the image. The replace() method uses a regular expression to find the current size parameter (designated by s[\d]+) and replaces it with the new size parameters (s" + width + "-c" + "-h" + height). The function then returns the resized image URL.


Let’s say you have an image URL and you want to resize it to be 200 pixels wide and 300 pixels tall. You can use this custom formula by entering the following formula in a cell:

=resizeImage("", 200, 300)

The formula will output the resized image URL that you can use to display the resized image in your Google Sheets.

The custom formula for image resizing in Google Sheets is called “getImage” and it can be used to fetch an image from a URL and resize it to fit within a specified size.