I'm trying to have a video play based on a random number generated in a spreadsheet. since google sheets doesn't allow you to embed youtube videos directly I'm trying to do it through a custom dialogue box.
Here's what I have so far:
Google Script Code
var PlayDes = sheet.getRange('g2').getValue();
GameSheet.getRange('D4').setValue(TotYds1)
var html = HtmlService.createHtmlOutputFromFile('Youtube')
.setWidth(560)
.setHeight(315);
SpreadsheetApp.getUi()
.showModalDialog(html, PlayDes);
Then the HTML code is:
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/7WSQGD874Yc?start=8&end=18" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
<input type="button" value="Close" onclick="google.script.host.close()" />
I'm looking to change the video URL in the html code based on the value that's pulled from cell G2 in a spreadsheet.