Published Google Sheet - How to remove hover tooltip? - html

Background
I have a Google spreadsheet that contains multiple chart sheets.
I want to publish the entire spreadsheet and embed it in an HTML page (plain single HTML page. no other files.)
I have this simple HTML embedding simple published Google spreadsheet.
<iframe height="400px" scrolling="no" src="https://docs.google.com/spreadsheets/d/e/2PACX-1vSE-4lufoePc8SMq1r5o9K_uWE7Km9JiouogYBUJHVBo8Esnf4tImqdNUiCcWu_26AzwDUZCM_wS1Vs/pubhtml?widget=true&headers=false" width="100%"></iframe>
Problem
I want to disable the tooltip-no-hover feature when the cursor is on some area of the chart (specifically one the bar itself).As a matter of fact, I want to disable any user interaction with the chart.
However, the user still needs to be able to navigate between the sheets.
Failed attempts
I'm new in this area so likely my attempts/coding is senseless.
<iframe enableInteractivity="False" ...
<iframe style="pointer-events: none;... - did not allow to navigate between sheets.

Unfortunately, what you want cannot be achieved.
According to the Charts Service documentation:
If you want to render charts in a web browser, use the Google Charts API instead.
The Google Charts Visualization API, however, allows you to modify the tooltip. But in order to do this, you will have to create the chart programmatically.
For this, you can try the example presented in the Quickstart here.
So after modifying the options parameter to this:
var options = {'title':'How Much Pizza I Ate Last Night',
'width':400,
'height':300,
'tooltip': { 'trigger': 'selection' }};
This is how the chart will look like when hovering over the Mushroom part:
You can include the code from the Quickstart mentioned above in an HTML file in Apps Script in order to create a web app. The only missing part is the doGet function, which can look something like this:
function doGet() {
var htmlOutput = HtmlService.createHtmlOutputFromFile('QUICKSTART_HTML_FILE');
return htmlOutput;
}
Reference
Google Charts Quick Start;
Google Charts Tooltips;
Apps Script Web Apps.

Related

google docs linked charts refresh with api or apps script

I have a google doc that I show inside an iframe in my website for public editing, it contains linked charts from a public spreadsheet,
I change the chart data with spreadsheet api, but the chart in the doc does not refresh automatically, and I can't clic update or update all in the doc because the "update button" is disabled,
SO I wanted to use google docs api or apps script to refresh charts,
I did not find how to do it with google docs api, and apps script does not trigger inside the iframe,
Can you please give me any idea how to do this,
Thank you.
Unfortunately there is no way to refresh charts programatically in a Google Document. You should definitely submit a feature request for SheetsChart support as there is in Google Slide App Script Service.
Workaround with Slides
Since the update feature is currently available for Slides you could achieve to style a Slide as a document and use it in your iFrame. Following this update logic you will be able to trigger a SheetsChart refresh every minute for example:
function myFunction() {
ScriptApp.newTrigger('updateCharts').timeBased().everyMinutes(1).create();
}
function updateCharts() {
let slides = SlidesApp.getActivePresentation().getSlides();
slides.forEach(slide => {
let charts = slide.getSheetsCharts();
charts.forEach(chart=> chart.refresh());
});
}
Workaround with Documents
However, since your goal is to provide your website viewers with the last version of the iFrame this can be done automatically on Document save:
File > Publish on the Web > check Automatically republish when changes are made
You will have to update manually the chart in your Document though. But this change will be reflected in your webpage automatically.

Unable to publish specific cells in new Google Spreadsheets

So I've started migrating items over to the the new google spreadsheets to take advantage of some of the limits being lifted.
I've run into a problem with the new spreadsheets not having an option to publish specific cells rather then the entire sheet. Ideally, I just want a specific cell range published so when it's on the site it remains clean and contained without the need to scroll. I've tried to fiddle with the links and the src to match the old code but it doesn't seem to work.
Here is an example of the old code that works:
<iframe width='544' height='249' frameborder='0' src='https://docs.google.com/spreadsheet/pub?key=0AkC6q_6fzB6WdDNGeTk2X1RGNzBJLVhaaWpld19FUlE&single=true&gid=4&range=B1%3AE11&output=html&widget=false'>
The publish dialogue in the old spreadsheet actually has the ability to select specific cell ranges where the new one doesn't appear to have that option.
Here is a sample of the new spreadsheet code that doesn't work:
<iframe width='544' height='249' src="https://docs.google.com/spreadsheets/d/1HqS9DqBK4r7Qtff8Ecy7wKRPsiSUW_03i9x95OwuW74/pubhtml?widget=true&headers=false"></iframe>
Finally here is a fiddle comparing the two: http://jsfiddle.net/blintster/N2qbv/
As you can see the first example is much cleaner.
SOLVED:
This is the code I used for the new google spreadsheets to publish only the cell range I wanted
<iframe width = "431"
height = "21"
frameborder = "0"
scrolling = "no"
src = "https://docs.google.com/spreadsheets/d/1HKjkaqDlCJwycKH4mlPnrZHzx4RMOyY6JXCsmH4/pubhtml?single=true&gid=35&range=D10:M10&widget=false&chrome=false"
style = "overflow: hidden;">
</iframe>
Replace the spreadsheet key with your own (go to Publish to the Web to find your own spreadsheet key)
gid=35 (This is the sheet id, you'll have to find this by publishing a sheet and seeing what number it comes up with)
range=D10:M10 (This is your cell range you want to show - no longer do you need to use a named range)
It is still possible to get specific cells using the feeds for the old Data apis but you then have to do some work in javascript to format the table from the json representation but you do end up with full control of the look. Here is a working feed:
https://spreadsheets.google.com/feeds/cells/19WD1dqLpctWWfDn0Gazs3pJz8OiV_P55QIXZcQ1mznk/od6/public/values?min-row=2&max-row=5&min-col=1&max-col=2&alt=json-in-script&callback=x
There are a few posts around dealing with the json-p eg Use a Google Spreadsheet as your JSON backend
M. Amedeo Tumolillo posted a way to embed iframes from the the new Google Sheets:
http://hellotumo.com/2012/11/28/how-to-embed-specific-cells-when-embedding-a-google-spreadsheet/

Is it possible to display a UI within google spreadsheet but not use the google container bound script?

I would like to design a UI for google spreadsheets but currently the options allow for a UI to be displayed as a seperate webpage or within the container bound scripting option. Webapps for other google products like gmail allow for content (html, etc.) to be drawn on/over/within the gmail page (the extension "equire" is a great example).
I would like to design a google sheet UI that functions similarly. Is this possible or am I bound to do UI either in a seperate webpage or inside the container-bound script?
You can write a Apps Script library that shows the UI. This script will not be container bound. However, you'll have to call this script's functions from within a container bound script with a shell function in your spreadsheet. Something like
Apps Script library (not container bound)
function showUI(){
/* UI code here */
}
In your spreadsheet
function onOpen(){ // or whatever
Library.showUI();
}
Maybe if you explain why you need to do this, then some other better alternative might arise

Google Apps Script UIApp : no way to create a clickable row in a dashboard tableChart?

I am a beginner in programming and I made a dashboard (populated by a spreadsheet) with Google Apps Script UIApp for my Google Apps website but I can't find the way to create a clickable row in the tableChart (I would like to open a link to a shared document previously stored in the Drive by clicking on each row). It seems impossible to use the Google Visualization APi in this UiApp. I tried to create a Handler but i was not able to link it with the tableChart...Am I wrong ?
Charts are used to display data, not to create interactive UI elements. You may want to look into using UiApp's FlexTable class to accomplish your goal.

Embed Google Spreadsheet inside Google Apps Script Web App

I am developing a web app using Google Apps Script where I fetch some JSON results from web. I'd like to present those results as a small spreadsheet embedded into one of the panels which is in the screen of the web app itself.
The idea is to do something like this:
var verPanel = app.createVerticalPanel();
verPanel.add(some_spreadsheet);
Is there any way how can I directly embed a spreadsheet object inside UI element?
Many thanks!
Michael
This is not currently possible.