Google Apps脚本:.appendRow()不会增加表单记录数 [英] Google Apps Script: .appendRow() doesn't increase form record count

查看:89
本文介绍了Google Apps脚本:.appendRow()不会增加表单记录数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张需要两种方式追加记录(行)的工作表。一个是关联的表单,另一个是关联的脚本。
该脚本执行成功.appendRow()和.getLastRow()增加,但下一个表单提交附加数据后面的错误行是privoius最后一行(.getLastRow-1)。
我也注意到了.appendRow()并没有在Form(123)这样的电子表格菜单中包含显示的数字。看起来电子表格有两种不同的最后一行。

是否有人帮助我增加脚本中的Last Rows形式。



谢谢

解决方案

这似乎是一个脚本没有被自动吸收到脚本中的问题与表单提交相关联的所谓的表格,其由浅灰色背景定义。后续表格提交将被添加到灰色区域的底部(不管下面的数据如何),表单提交计数将只处理灰色区域中的行。



一个笨拙的解决方法是在追加行后使用copyTo方法复制数据:

  sheet.getRange(sheet .getLastRow(),1,1,sheet.getLastColumn())
.copyTo(sheet.getRange(sheet.getLastRow(),1,1,sheet.getLastColumn()));

HTH



Adam


I have a sheet which needs two ways to append records(rows). One is the associated Form and another is the associated script. The script performs successfull .appendRow() and .getLastRow() was incremented, but the next Form submittion appends data after the wrong row which was the privoius last row (.getLastRow-1). I also noticed .appendRow() does not inclease the number shown after Form in the spreadsheet menu like Form(123). It seems like the spreadsheet has two different Last Rows.

Is anyone help me to increase The form Last Rows in a script.

Thanks

解决方案

This appears to be an issue with data populated by a script not being automatically absorbed into the so-called Table associated with Form submissions, which is defined by the light grey background. Subsequent Form submissions will be added to the bottom of the grey area (regardless of data underneath), and the Form submission count will only address the rows in the grey area.

A clumsy workaround is to use the copyTo method to copy the data in place, after appending the row:

sheet.getRange(sheet.getLastRow(),1,1,sheet.getLastColumn())
     .copyTo(sheet.getRange(sheet.getLastRow(),1,1,sheet.getLastColumn()));

HTH

Adam

这篇关于Google Apps脚本:.appendRow()不会增加表单记录数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆