Essentially, I am attempting to print an image onto a worksheet by changing the color of every cell. When it comes to small images, it can do it just fine. However most images I will be importing are more than 100x100. Not only is this incredibly slow, but I cant do it without exceeding my quota limit.
I don't think using format()
1000+ times is very optimal, is there a way to set up my formats and then "push" it onto a worksheet without calling the API too many times?
for row in rows:
for column in columns:
color = (image.get_at((column, row)))
address = utils.rowcol_to_a1(row+1, column+1)
#the part where it formats the cell
sheet2.format(str(address), {"backgroundColor": {'red': color[0]/255, 'green': color[1]/255, 'blue': color[2]/255}})
image.get_at()
is from another module, it just gets the color of a pixel.
sheet2.format()
is called for every single pixel in the image.
I understand I can use time.sleep()
to wait for the quota to reset, but at that rate it will take forever to import any decent sized image.