Search code examples
pythongoogle-sheetsgspread

Does the Google Spreadsheet Python API or gspread allow images or rich text?


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.)?


Solution

  • 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.