user3097241
user3097241

Reputation: 1

Google Spreadsheet Apps Script - HTML Service

Is there any way I can write the output of the html object directly to a cell, instead of a dialog box. If it's not possible, I am trying to figure a way so that I can capture the output from the dialog box and paste it into a cell. My goal is to include javascript into the html, evaluate the code, and send the output to a cell on the spreadsheet. The below code is from Apps Script tutorial (https://developers.google.com/apps-script/guides/html/)

gs.code:

var ss = SpreadsheetApp.getActive();

function onOpen() {
  var menu = [{name: 'Open', functionName: 'openDialog'}];
  ss.addMenu('Dialog', menu);
}

function openDialog() {
  var html = HtmlService.createHtmlOutputFromFile('index');
  ss.show(html);
}

index.html:

< input type="button" value="Close" onclick="google.script.host.close()" />

Upvotes: 0

Views: 1419

Answers (1)

Zig Mandel
Zig Mandel

Reputation: 19835

Just getActiveSpreadsheet from your html code and write it to the cell you want from there.

Upvotes: 0

Related Questions