1. jasoothai

    jasoothai Well-Known Member

    Dec 21, 2011
    function doGet() {
    var output = HtmlService.createHtmlOutputFromFile('labnol');
    output.setTitle('Publish Website on Google Drive');
    return output;

    function uploadWebsite(form) {

    try {

    var zip, files, name, folder, file, host, found=false;

    zip = form.zipFile.setContentType("application/zip");
    files = Utilities.unzip(zip);

    // Unique folder name based on the current date and time
    name = Utilities.formatDate(new Date(), "GMT", "ddMMyyyyHHmmss");
    folder = DriveApp.createFolder("Website #" + name);

    for (var i=0; i<files.length; i++) {
    file = folder.createFile(files);
    if (file.getName() === "index.html") {
    found = true;

    if (found) {
    // Set the sharing permissions of the Drive folder as Public
    folder.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.VIEW);
    var site = "https://googledrive.com/host/" + folder.getId() + "/";
    return 'Your <a href="' + site + '" target="_blank">website</a> is now live on Google Drive. The URL is: ' + site;
    } else {
    // if the index.html file is not available, don't publish the website

    return "Sorry, we couldn't find an index.html in your zip file. Please try again.";

    } catch (e) {
    return e.toString();


    I got above code from a website. How to setup it in Google app scripts.
    When I deploy as a webapp I got No HTML file named labnol was found. (line 2, file "Code"). Please tell me how to fix it. Following is the link to the app. https://script.google.com/d/1dgiEpSyWnc6MjbZ1rDwFas43eb0BGT5W-GXINRa-ME48t-uQRF-nNALi/edit
  2. t33p

    t33p Well-Known Member

    Mar 22, 2015
    Are you sure that such scripts are allowed for use on a network drive?
  3. jasoothai

    jasoothai Well-Known Member

    Dec 21, 2011
    Yes bro, do you know how to make it work.

Share This Page