Convert range to image

Refer to the following example code to see how to convert a spreadsheet range to an image.