Skip to content
Advertisement

use an array from Google Sheets to create a data list in html that can be served to a Google Apps Script for Autocomplete a Text Input

I have been struggling for a couple days to build a simple interface for my colleagues to record every customer interaction. They will input the following:

  1. Name of Customer (Autocomplete feature, from a superset of all names in a column in the spreadsheet)
  2. Date of Interaction
  3. Summary of the Interaction
  4. Prospects (Hot, Warm, Tepid, Cold)

My problem is in getting the Autocomplete working.

I have seen threads where @Tanaika has beautifully laid down the Server Side, HTML+JS, etc. but I am unable to get this to work. My files are attached. Thanks for your time!

HTML+JS

JavaScript

CODE.GS

JavaScript

Advertisement

Answer

Modification points:

  • In your HTML, the template is used. In this case, please use createTemplateFromFile instead of createHtmlOutputFromFile.
  • The scriptlet of <?!= ... ?> is Force-printing scriptlets (like printing scriptlets except that they avoid contextual escaping.). Ref

I thought that these are the reasons for your issue. When these points are reflected to your script, it becomes as follows.

Modified script:

Google Apps Script side:

From:

JavaScript

To:

JavaScript
  • Here, your function of readData() is used.

HTML and Javascript side:

From:

JavaScript

To:

JavaScript

Reference:

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement