Table visualization: insert an image in a cell (from GDocs)

255 views
Skip to first unread message

Frans

unread,
May 17, 2012, 2:04:04 PM5/17/12
to google-visua...@googlegroups.com
Hi,
I'm trying to insert a Google Spreadsheet in an html document and show it as a table.
So, my source is a Google Docs document and I call it with a query (var query = new google.visualization.Query).

My table is a list of countries with some data about them. Html visualization until this point is OK.

But I want to add a column with an image (a flag). I don't know if it's possible to do this and, if possible, how to do it.

I've tried to put the link in the cell of the Google Spreadsheet, copy-paste an image, and an img src="...", but no luck. The only thing I have is the code written inside the cell both in the GDocs and the html visualization.

I've defined as an option(var options = {allowHtml: true};

Any suggestion?

Thank you in advance!

asgallant

unread,
May 17, 2012, 3:00:35 PM5/17/12
to google-visua...@googlegroups.com
Table visualizations are just HTML tables, so if you set the 'allowHtml' option to true, it should work if your img tags are formatted properly.  The query won't return the images themselves if you place them in the spreadsheet, the best way to handle it is to either:

a) include image tags in a column of the spreadsheet as strings ('<img src="http://path/to/img.jpg" />') or
b) include urls to the images in a column of the spreadsheet and use a PatternFormatter to create the image tags
Reply all
Reply to author
Forward
0 new messages