Creating a web app to render Sheet data as HTML
We will create an application to return Sheet data as HTML in the browser. Create a Sheet, rename it as Data
, and populate it with some test data as shown in the next screenshot. You can populate the Sheet with any random data with the three columns named First Name
, Last Name
, and Full Name
:
In the Code.gs
file, create the doGet
function as shown here:
function doGet() { /* * This spreadsheet may not be active while this function * executes, so you cannot get access to active spreadsheet, * use open by id. * */ var ss = SpreadsheetApp .openById("Replace with this spreadsheet id"); var SheetData = ss.getSheetByName("Data"); var data = SheetData.getDataRange().getValues(); var html = '<!DOCTYPE html><html><body><table border=1>'; // Each row data passed as argument to the anonymous function. data.forEach(function(row){ html += '<tr>'; html += '<td>' + row...