Images

The Image class lets you interact with images in Excel.

class Image(filepath[, sheet = ''])

Puts the image file from filepath on sheet.

>>> picture = Image("C:/Users/DataNitro/awesome.png")
## puts awesome.png on the active sheet
x
y

Determine the position of an image.

>>> picture.x = 10
## moves picture to 10 pixels from the left side of the spreadsheet.
height
width

Determine the size of an image.

>>> picture.height *= 2
## doubles picture's height
angle

Sets the angle of an Image. Initially 0.

>>> picture.angle += 45
## rotates picture 45 degrees clockwise
remove()

removes an Image.

>>> picture_2 = Image("C:/Users/DataNitro/less_awesome.png")
## adds an image
>>> picture_2.remove()
## removes the image
update([filepath = ''])

Updates an Image with a new file, preserving its size and location.

>>> picture.update()
## updates picture from its last used filepath
>>> picture.update("C:/Users/DataNitro/more_awesome.png")
## updates picture from a different filepath

NitroPlot

nitroplot is a wrapper for the PyPlot library. It takes the same commands as PyPlot, with the exception of show. Instead of show, you can use graph to output plots to Excel:

nitroplot.graph([sheet = ''])

Writes a nitroplot graph to sheet.

>>> import nitroplot
>>> x = range(1000)
>>> y = [i**2 for i in x]
>>> nitroplot.plot(x, y)
## plots y = x**2
>>> nitroplot.graph()
## outputs y = x**2 to the active sheet

You can see the nitroplot source code in your DataNitro/DataNitroPackages directory, and you can learn about PyPlot from its documentation.

Other Functions

all_images([sheet = ""])

returns all images on sheet as Image objects.

>>> all_images("Sheet1")
["Red", "Blue", "Green"] ## the images on Sheet1
lock_images([sheet = "", scale_cells = True])

locks all images on sheet to the nearest cell. This enables sorting images in tables.

If scale_cells is True, each cell with an image will be stretched to fit that image.

>>> lock_images()
## locks images on the active sheet