简体   繁体   中英

How to get the width and height of an image by Url in Google Sheets

I have in a Google Sheet a list of images by URL. Images are on a remote server. I got the preview in my Sheet by the Image (URL) function.

Is there a way to get the width and height of each remote image in each row by formula or script?

示例

Looking through the Google Community docs, found this question asked here with no apparent solution.

It's not exactly what you're looking for, but you could use the IMAGE function to set the dimensions your images.

IMAGE(url, [mode], [height], [width])

url - The URL of the image, including protocol (eg http://).

The value for url must either be enclosed in quotation marks or be a reference to a cell containing the appropriate text. mode - [ OPTIONAL - 1 by default ] - The sizing mode for the image

1 resizes the image to fit inside the cell, maintaining aspect ratio.

2 stretches or compresses the image to fit inside the cell, ignoring aspect ratio.

3 leaves the image at original size, which may cause cropping.

4 allows the specification of a custom size.

Note that no mode causes the cell to be resized to fit the image.

height - [ OPTIONAL ] - The height of the image in pixels. mode must be set to 4 in order to set a custom height.

width - [ OPTIONAL ] - The width of the image in pixels. mode must be set to 4 in order to set a custom width.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM