Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Spreadsheet adding tooltip

I need to add a tooltip (mouser over a cell) in a Google spreadsheet.

I want the tooltip text to be taken from another cell, some idea?

Thanks in advance!

like image 797
sergio Avatar asked Jun 17 '17 10:06

sergio


People also ask

How do you add a hover in Google Sheets?

You can use the formula =HYPERLINK(<cell>,IMAGE(<cell>)) to both create an image preview and a link at the same time. Once the formula has been applied, simply select the cell you want to preview and hover over the link pop-up that appears. The full image should appear in a floating pop-up.

What is tooltip in Google Sheets chart?

Tooltips are the little boxes that pop up when you hover over something. (Hovercards are more general, and can appear anywhere on the screen; tooltips are always attached to something, like a dot on a scatter chart, or a bar on a bar chart.)


1 Answers

Consider using notes - they appear when you hover mouse over cells in a spreadsheet. You can add notes manually by clicking the right mouse button on a cell and selecting 'insert note'. This can also be done programmatically.

Say, you've got 2 adjacent cells. We'll use text from the second cell to add a note to the first one. enter image description here

You can create the note with the text from the second cell using the following code.

function addNote() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheets()[0];
  var targetCell = sheet.getRange("A1");
  var sourceCell = sheet.getRange("B1");

  var noteText = sourceCell.getValue();

  targetCell.setNote(noteText);

}

Here's the end result after executing the function enter image description here

You can modify the code to make it run only when the sheet is edited and dynamically update the note when the text in the source cell changes.

like image 125
Anton Dementiev Avatar answered Sep 19 '22 15:09

Anton Dementiev