Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
Why is the html script not getting the list from my code.gs file

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

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

<script>
      function printData(){
        const list = google.script.run
        .withSuccessHandler((list) => document.write(list))
        .youtube("test")
      }
</script>

success handler

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!