Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display message Google Sheets from Apps Script

I want to display a message on a google sheet. But I don't get it, and, after research here, in documentation, I don't get the answer.

I think that the problem is in "activate" the spreadsheet, where i need to display.

var SEGUIMIENTO = SpreadsheetApp.openById("MyTestediD");
var INF = SEGUIMIENTO.getSheetByName("NameOfSheet");
function TestMessage() {
  INF.activate();
  Browser.msgBox("Hello")
}

When i run.. nothing happen

I need the definition of Spreadsheet outside the function because I'm working in 2 Spreadsheet's by ID in more that one function.

i only need the correction in my code for display a simple message in the spreadsheet.

PD. i really cant find a simple example of that,

Update

This code it's part of a macro recorder of a Spreadsheet, the same "SpreadsheetApp.openById("MyTestediD");"

like image 980
José Luis Zarabanda Díaz Avatar asked Dec 15 '18 19:12

José Luis Zarabanda Díaz


People also ask

Can Google Apps Script send text message?

Google Sheets comes with a JavaScript-based language called Apps Script. In this tutorial we'll use Apps Script to send SMS messages to phone numbers stored in a Google spreadsheet. The steps take less than ten minutes to complete — even if you've never written a line of code.


1 Answers

I don't know why you try to 'activate' a sheet. If you want display a message I assume you want to do it in the user's current sheet, so:

SpreadsheetApp.getUi().alert('Confirmation received.');
like image 151
R.Atzeni Avatar answered Sep 21 '22 16:09

R.Atzeni