Display html contents by appsscriptlab - CodyLab

HTML CSS AND APPSSCRIPT BASE PROJECT DEMO

HTML CSS AND APPSSCRIPT BASE PROJECT DEMO

 Dear, here we shall see that how to display html contents using apps script.

For this goal, we have to follow the following steps:

Step:1

Go  to AppsScript home page and create a new project.

Step:2

Paste the following Code into code.gs file.


function  doGet () {
 var  x ;
     x = HtmlService.createTemplateFromFile('Index').evaluate();
     x.setTitle("Project Title");
    return x;
}
// to inclue other type of file like css,javascript etc. add following code snippets
// and also add .evaluate(); as above.
 function include(filename) {
  return HtmlService.createHtmlOutputFromFile(filename)
      .getContent();
}

Step: 3

Create an html file from file menu. And name the file:  Index.html

And write what you want to display in boby tag or paste the following.

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <?!= include('css') ?>
  </head>
  <body>
    Hello, World!
   <p> Write here what you want to display. </p>
   <marquee behavior="scroll" direction="up" scrollamount="1">
Slow Scrolling</marquee>
   <marquee behavior="scroll" direction="right" scrollamount="12">
Little Fast Scrolling</marquee>
   <marquee behavior="scroll" direction="left" scrollamount="20">
Fast Scrolling</marquee>
   <marquee behavior="scroll" direction="right" scrollamount="50">
Very Fast Scrolling</marquee>
  </body>
</html>

Step : 4

To add css style, create an html file from file menu. And name the file:  css.htm

and past following css code snippets.

   
<style>
p{
  color:red;
  size:15px;
}
</style>


Step: 5

Deploy the project in Test Deployments and validate authorisation. 

For live demo Click here. Demo

CodyLab Blogger CodyLab Blogger
                                                                             Have a nice day!
-------------------------- -------------------------

Post a Comment

Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.