Column A | Column B |
---|---|
Cell 1 | Cell 2 |
Cell 3 | Cell 4 |
I would like images from cell 2 or 4 over cell 3 (& not inside the cell) dependant on what is in Cell 1.
- Image ‘KF2.jpg’ in Cell 2.
- Image ‘KF4.jpg’ in Cell 4.
I would like;
- ‘KF2.jpg’ over cell 3 when Cell 1 changes to 200.
- ‘KF2.jpg’ over cell 3 to change to ‘KF4.jpg’ when Cell 1 changes to
600.
I have tried scripts from the excellent ‘Tanaike’ that grab images from the web or Google drive but I can’t find a way of changing an over-cell image. I also hope by grabbing them from the same Google sheet would be more future proof and faster to load.
I have used this script from Tanaike but would like to adapt to use an image from same sheet that can be changed;
> function TanikeGDimageOverCells() {
//puts Google drive image in A2
> const imageFileId = "0BxWwc9tEdCGOTHEtc3hLYl9vNGc";
// imageFileID is the Google Drive image address between the last two / /
// To get image address right click image in Google Drive>Share>Copy Link. Can paste after // on this code page
// https://drive.google.com/file/d/0BxWwc9tEdCGOTHEtc3hLYl9vNGc/view?usp=sharing&resourcekey=0-tamUYNwWIaOhtc14-W216A
// Takes approx. 3 seconds for 14kb image
// Note Image must be less than 2mb
> const blob = DriveApp.getFileById(imageFileId).getBlob();
// Prepares image
> SpreadsheetApp.getActiveSheet().insertImage(blob, 1, 2);
// Put image over cells, first No. is col, row
}