Reputation: 87
I am trying to pass the value "assetCell" to the HTML dialog box. It seems simple enough . . . thank you for any help.
GAS
function Test(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var MySH = ss.getActiveSheet();
var Assetcell = MySH.getRange("f8").getValue()
var Assetcellb = MySH.getRange("f10").getValue()
var t = HtmlService.createTemplateFromFile('vIndex'); // Modified
t.AssetCell = Assetcell
t.AssetCell = Assetcellb
html = t.evaluate().setWidth(400).setHeight(300); // Added
SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
.showModalDialog(html, 'Hi');
}
HTML
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<?!= AssetCell => ?>
</body>
</html>
Upvotes: 1
Views: 1984
Reputation: 201378
How about this modification?
function Test(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var MySH = ss.getActiveSheet();
var Assetcell = MySH.getRange("f8").getValue()
var t = HtmlService.createTemplateFromFile('vIndex'); // Modified
t.AssetCell = Assetcell; // Added
html = t.evaluate().setWidth(400).setHeight(300); // Added
SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
.showModalDialog(html, 'Hi');
}
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<?!= AssetCell ?> => <!-- Modified -->
</body>
</html>
If this was not useful for you, I'm sorry.
<?!= AssetCell ?>
You can use the same HTML.
var ss = SpreadsheetApp.getActiveSpreadsheet();
var MySH = ss.getActiveSheet();
var Assetcell1 = MySH.getRange("f8").getValue();
var Assetcell2 = MySH.getRange("f10").getValue();
var t = HtmlService.createTemplateFromFile('vIndex'); // Modified
t.AssetCell = [Assetcell1, Assetcell2]; // Added
html = t.evaluate().setWidth(400).setHeight(300); // Added
SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
.showModalDialog(html, 'Hi');
<?!= AssetCell1 ?>
and <?!= AssetCell2 ?>
, respectivelyvar ss = SpreadsheetApp.getActiveSpreadsheet();
var MySH = ss.getActiveSheet();
var Assetcell1 = MySH.getRange("f8").getValue();
var Assetcell2 = MySH.getRange("f10").getValue();
var t = HtmlService.createTemplateFromFile('vIndex'); // Modified
t.AssetCell1 = Assetcell1; // Added
t.AssetCell2 = Assetcell2; // Added
html = t.evaluate().setWidth(400).setHeight(300); // Added
SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
.showModalDialog(html, 'Hi');
HTML
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<?!= AssetCell1 ?> => <!-- Modified -->
<?!= AssetCell2 ?> => <!-- Modified -->
</body>
</html>
Upvotes: 1