Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 499
dslack Avatar asked Sep 14 '15 17:09

dslack


People also ask

What is gspread in Python?

gspread is a Python API for Google Sheets. Features: Google Sheets API v4. Open a spreadsheet by title, key or url. Read, write, and format cell ranges.

Can Python read from Google Sheets?

We have successfully Read Data from the Google Sheets using Python. For creating the GUI of the project we used Tkinter Module. And we have done a little setup and using oauth2 library, we have established connection with the google sheet. In this way now we know how to read data from a google sheet using Python.


1 Answers

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.

like image 103
dyeray Avatar answered Sep 30 '22 17:09

dyeray