Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

374
Vistas
How do I include a file in HTML Google Apps Script?

I have attempted to create a new app, with app script, and I am attempting to use scriptlets but without success

function doGet() {
  return HtmlService.createHtmlOutputFromFile('index');
}

function include(filename) {
  return HtmlService.createHtmlOutputFromFile(filename).evaluate().getContent();
}

but nothing to do when verifying deployment doesn't work

<?!=include('Stylesheet'); ?>

please, help me!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In your situation, if <?!=include('Stylesheet'); ?> is included in index.html file, how about the following modification?

From:

function doGet() {
  return HtmlService.createHtmlOutputFromFile('index');
}

function include(filename) {
  return HtmlService.createHtmlOutputFromFile(filename).evaluate().getContent();
}

To:

function doGet() {
  return HtmlService.createTemplateFromFile('index').evaluate();
}

function include(filename) {
  return HtmlService.createHtmlOutputFromFile(filename).getContent();
}

Note:

  • If filename of include(filename) has the scriptlets, please modify as follows.

      function include(filename) {
        return HtmlService.createTemplateFromFile(filename).evaluate().getContent();
      }
    
  • In your script, it seems that Web Apps is used. In this case, when you modified the Google Apps Script, please modify the deployment as a new version. By this, the modified script is reflected in Web Apps. Please be careful this.

  • You can see the detail of this in the report of "Redeploying Web Apps without Changing URL of Web Apps for new IDE".

References:

  • createTemplateFromFile(filename)
  • createHtmlOutputFromFile(filename)
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda