8

Is it possible with gspread or other Python-based access to Google Spreadsheets to insert an image into a spreadsheet?

Also, is it possible to make rich text cells (e.g., bold, italic, different fontsize, colors, etc.)?

dslack
  • 835
  • 6
  • 17

1 Answers1

5

The question is a bit old, but today I had to check this for myself, so this may be useful for people that arrive here.

Insert an image: I'm not sure if inserting images as objects (as in the Google Sheets UI) is possible, but one way of doing it is setting the content of the cell to =IMAGE("<url of image>"). I believe the image here needs to be a public link, so a direct link to a protected Google Drive resource wouldn't work (even if the user has permission to access it).

Formatting cells: Now there is package gspread-formatting to do this, but it could be also done calling the v4 of spreadsheets API.

dyeray
  • 1,056
  • 6
  • 17
  • 1
    I made multiple searches before coming across this, and it works perfectly in my case, thanks :) – Peter Jan 05 '21 at 10:17