Google Apps Script
例

function doGet(e) {  
  var searchTerm = 'Script Tools'
  var ui = XmlService.createDocument(XmlService.createElement('html')).setDocType(XmlService.createDocType('html'))
  var body = XmlService.createElement('body')  
  body = buildTree(body, searchTerm);
  ui.getRootElement().addContent(body)
  return HtmlService.createHtmlOutput(XmlService.getRawFormat().format(ui))
}


function buildTree(node, searchTerm) {
  var ul = XmlService.createElement('ul').addContent(XmlService.createElement('p').addContent(XmlService.createText(searchTerm))); 
  // Use of the Apps Script DriveApp Service to retrieve the collections.  
  var folders = DriveApp.getFoldersByName(searchTerm).next().getFolders()
  while (folders.hasNext()){    
    var thisFolder = folders.next();   
    var li = XmlService.createElement('li');   
    var resp = buildTree(li, thisFolder.getName())            
    ul.addContent(li);
  }

  var files =  DriveApp.getFoldersByName(searchTerm).next().getFiles()   
  while (files.hasNext()) {    
    var thisFile = files.next()    
    if (thisFile.getMimeType() === "application/vnd.google-apps.document") {
      urlBase = "https://docs.google.com/document/edit?id=";
      iconHTML = "https://drive-thirdparty.googleusercontent.com/32/type/application/vnd.google-apps.document";
    }    
    else if (thisFile.getMimeType() === "application/vnd.google-apps.spreadsheet") {      
      urlBase = "https://spreadsheets.google.com/ccc?key=";
      iconHTML = "https://drive-thirdparty.googleusercontent.com/32/type/application/vnd.google-apps.spreadsheet";
    }
    else if (thisFile.getMimeType() === "application/vnd.google-apps.script") {      
      urlBase = "https://docs.google.com/fileview?id=";
      iconHTML = "https://drive-thirdparty.googleusercontent.com/32/type/application/vnd.google-apps.script";
    }
    else if (thisFile.getMimeType() === "application/vnd.google-apps.presentation") {       
      urlBase = "https://docs.google.com/present/edit?id=";
      iconHTML = "https://drive-thirdparty.googleusercontent.com/32/type/application/vnd.google-apps.presentation";
    }
    else if (thisFile.getMimeType() === "application/vnd.google-apps.drawing") {       
      urlBase = "https://docs.google.com/drawings/edit?id=";
      iconHTML = "https://drive-thirdparty.googleusercontent.com/32/type/application/vnd.google-apps.drawing";       
    }
    else {
      urlBase = "https://docs.google.com/fileview?id=";
      iconHTML = "https://drive-thirdparty.googleusercontent.com/32/type/application/application/vnd.google-apps.unknown";    
    }    
    
    var li = XmlService.createElement('li');     
    var image = XmlService.createElement('img').setAttribute('src', iconHTML);    
    var fileLabel =  XmlService.createElement('a').setAttribute('href', urlBase + thisFile.getId())
                      .setAttribute('target', '_blank').addContent(XmlService.createText(thisFile.getName()))
    var fileLabelPanel = XmlService.createElement('div').setAttribute('style', 'display:flex;flex-direction: row;')
    fileLabelPanel.addContent(image)
    fileLabelPanel.addContent(fileLabel)    
    li.addContent(fileLabelPanel)
    ul.addContent(li)
  }    
  node.addContent(ul)
  return node;   
}