I am working on a youtube sort of thingy but I've been testing it and it doesn't paste the youtube titles into the custom dialog. I have 2 files. Code.gs and youtube.html. Here are the files
Code.gs
function youtube(input1){
const list = []
const sr = YouTube.Search.list("snippet", {q: input1, maxResults: 50})
sr.items.forEach(function(vid){
list.push(vid.snippet.title)
})
return list
}
youtube.html
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<button onclick="printData()">Return</button>
<script>
function printData(){
const list = google.script.run.youtube("test")
document.write(list)
}
</script>
</body>
</html>
When I run it, it just does nothing when I click the button
<script>
function printData(){
const list = google.script.run
.withSuccessHandler((list) => document.write(list))
.youtube("test")
}
</script>