Tree and TreeItem

This simple example will show you to make a multilevel tree map using Google Apps Script.


Example Demo:

To try the demo, click on tree items

Example Code:


tree Map













function doGet(e) {

  var app = UiApp.createApplication();

  //Create a tree

  var tree = app.createTree().setAnimationEnabled(true);


  //Create Top lavel Items

  var item0 = app.createTreeItem('Item0');

  var item1 = app.createTreeItem('Item1');


  //Create second level Items for item0

  var item00 = app.createTreeItem('Item00');

  var item01 = app.createTreeItem('Item01');



  //Create third level Items

  var item000 = app.createTreeItem('Item000');

  var item001 = app.createTreeItem('ITem001');

  var item002 = app.createTreeItem('Item002');



  //Create Fourth level Item

  var item0010 = app.createTreeItem('Item0010');

  var item0011 = app.createTreeItem('Item0011');



  //Add the top level items to tree





  return app;




Tree, TreeItem in Google Apps Script, Create multilevel tree using Apps Script