forked from griptape-ai/griptape
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacro.gs
42 lines (34 loc) · 1.42 KB
/
macro.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/** @OnlyCurrentDoc */
/**
* Reduces the size of the last pasted image by half.
*/
function resizeLastPastedImage() {
// Get the active spreadsheet and sheet.
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = spreadsheet.getActiveSheet();
// Get the last edited range (assuming it's the pasted image).
var lastEditedRange = sheet.getLastEditedRange();
// Check if the last edited range contains an image.
if (lastEditedRange.getNumImages() > 0) {
// Get the image.
var image = lastEditedRange.getImage();
// Get the current width and height of the image.
var currentWidth = image.getWidth();
var currentHeight = image.getHeight();
// Calculate the new width and height (half the original size).
var newWidth = currentWidth / 2;
var newHeight = currentHeight / 2;
// Resize the image.
image.setWidth(newWidth).setHeight(newHeight);
} else {
// Display an error message if no image was found.
Browser.msgBox('No image found in the last edited range.');
}
function copycontent() {
var spreadsheet = SpreadsheetApp.getActive().getActiveSheet();
var images = spreadsheet.getImages();
var img = images[images.length - 1] // last image
//var w = img.getImages()
spreadsheet.getRange('C13').activate();
// spreadsheet.getRange('C13').currentWidth SpreadsheetApp.CopyPasteType.PASTE_VALUES, false)
};}