Get data from HTML page to Google spread sheet

前端 未结 1 1640
情话喂你
情话喂你 2021-01-28 01:26

I have four user input text fields in html created to user input data. I want to pass this four values into Google spreadsheet. This HTML is created using Google script. I am no

1条回答
  •  一生所求
    2021-01-28 02:08

    This is a simple html file communicating with Google Apps Script contained in a Spreadsheet. The html file and the Google Apps Script communicate with each other and I pass one array from the html file to the Google Script. Hope this helps.

    The Code.gs file:

    function doGet()
    {
      var html = HtmlService.createHtmlOutputFromFile('index');
      return html.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
    
    }
    
    function getData(a)
    {
      var ts = Utilities.formatDate(new Date(), "GMT-6", "M/d/yyyy' 'HH:mm:ss");
      a.splice(0,0,ts);
      var ss=SpreadsheetApp.openById('SPREADSHEETID')
      ss.getSheetByName('Form Responses 1').appendRow(a);
      return true;
    }
    
    function getURL()
    {
      var ss=SpreadsheetApp.openById('SPREADSHEETID');
      var sht=ss.getSheetByName('imgURLs');
      var rng=sht.getDataRange();
      var rngA=rng.getValues();
      var urlA=[];
      for(var i=1;i

    The index.html file:

    
    
      
        
      
      
      

    Text 1
    Text 2
    Text 3
    Text 4
    Member
    Guest
    Intruder

    img1

    0 讨论(0)
提交回复
热议问题