猿问

将表单数据收集到 Google 表格时遇到更多麻烦

我有一个运行良好的脚本,我上次尝试它时运行良好,尽管从那以后我向它添加了一些东西并使它成为一个多页表单。代码似乎收集数据,但似乎没有将其传输到谷歌表。自从上次这样工作以来,我没有更改过输入的名称。


Code.gs:


function doGet() {

  return HtmlService

      .createTemplateFromFile('jSignature')

      .evaluate();

}

function saveImage(bytes, sign){

  var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('FormResponse');

  var dateObj = Date.now();

  var bytes = bytes.split(",")

  var blob = Utilities.newBlob(Utilities.base64Decode(bytes[1]), 'image/png');

  var fileName = blob.setName("Signature "+dateObj).getName();

  var sigFolder = DriveApp.getFolderById("my folder"); //replace with your folder id

  var url = sigFolder.createFile(blob).getId();

  Logger.log(url)

  var carrier = sign.carrier;

  var address = sign.address;

  var dname = sign.dname;

  var dnum = sign.dnum;

  var date = sign.date;

  var time = sign.time;

  var tractortruck = sign.tractortruck;

  var odom = sign.odom;

  var aircompressor = sign.aircompressor;

  var airlines = sign.airlines;

  var BeltsandHoses = sign.BeltsandHoses;

  var Body = sign.Body;

  var BrakeAccessories = sign.BrakeAccessories;

  var BrakesParking = sign.BrakesParking;

  var BrakesService = sign.BrakesService;

  var Clutch = sign.Clutch;

  var CouplingDevices = sign.CouplingDevices;

  var DefrosterHeater = sign.DefrosterHeater;

  var DriveLine = sign.DriveLine;

  var Engine = sign.Engine;

  var Exhaust = sign.Exhaust;

  var FifthWheel = sign.FifthWheel;

  var FluidLevels = sign.FluidLevels;

  var FrameandAssembly = sign.FrameandAssembly;

  var FrontAxle = sign.FrontAxle;

  var FuelTanks = sign.FuelTanks;

  var Horn = sign.Horn;

  var Lights = sign.Lights;

  var Mirrors = sign.Mirrors;

  var Muffler = sign.Muffler;

  var OilPressure = sign.OilPressure;

  var Radiator = sign.Radiator;

  var RearEnd = sign.RearEnd;

  var Reflectors = sign.Reflectors;

  var SafetyEquipment = sign.SafetyEquipment;

  var Starter = sign.Starter;

  var Steering = sign.Steering;

  var SuspensionSystem = sign.SuspensionSystem;

  var TireChains = sign.TireChains;

  var Tires = sign.Tires;

}


蝴蝶不菲
浏览 156回答 1
1回答

月关宝盒

您从表单中检索了 47 个值,但您的范围ss.getRange(ss.getLastRow()+1, 2, 1, 48)的宽度为 48。这就是未将值设置到电子表格中的原因。您需要做的就是将代码修改为ss.getRange(ss.getLastRow()+1, 2, 1, 47)此外,请记住,您在landscapeCheck();内调用了该函数function showTab(n),但该函数并未在您的代码中的任何位置定义。
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答