Tricks for Google Sheets

Buncha short stuff

Resize last image to cell size

function onEdit(e) { resizeLastImage(); } function resizeLastImage() { const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); const images = sheet.getImages(); if (images.length === 0) return; // Exit if there are no images in the sheet // Get the last image added (the last item in the array of images) const lastImage = images[images.length - 1]; // Resize the last image to fit the cell lastImage.setWidth(52); lastImage.setHeight(25); }

Thursday, 30/01/2025, 11:41 in the morning.
© Dhruv · 2025