[英]Not able to export the sheet data in web app
I am using a web app which consists search button on top, as per search criteria it will pull the data from a sheet. 我正在使用一个Web应用程序,该应用程序在顶部包含搜索按钮,根据搜索条件,它将从工作表中提取数据。
After adding the date in sheet (example Date format-1/4/2017), it stopped working. 在工作表中添加日期(例如日期格式-1/4/2017)后,它停止工作。 If i remove the date (column C)then it works perfactly fine 如果我删除日期(C列),那么它可以正常工作
Please help me to fix the issue 请帮我解决问题
Complete code and sample sheet for your reference [Sheet][1] 完整的代码和示例表,供您参考[表格] [1]
[1]: [1]:
You need to use getDisplayValues()
instead of getValues()
and also you need to convert date string to date object. 您需要使用getDisplayValues()
而不是getValues()
并且还需要将日期字符串转换为date对象。 Replace the below lines in code.gs 将以下行替换为code.gs
var aData=sheetDatabase.getRange(searchResult+2, 1, 1,sheetDatabase.getLastColumn()).getDisplayValues();
aData[0][1]= Utilities.formatDate(new Date(aData[0][1]), "GMT +1","yyyy-MM-dd hh:mm:ss a");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.