我在一个网站上运行的脚本给了我一个错误:服务错误:SitesApp:条目必须有一个纯文本、非空标题(第 16 行)
function parseNews() {
var SS = SpreadsheetApp.openById("MY_SPREADSHEET_KEY");
var SourcePage = SS.setActiveSheet(SS.getSheetByName("Current"));
var TargetPage = SS.setActiveSheet(SS.getSheetByName("Archive"));
var TotalRows = SourcePage.getLastRow();
var RowCount;
var pages = SitesApp.getSite('mydomain.co.uk','home').getChildren();
Logger.log(pages.length);
for (RowCount=1;RowCount++;RowCount <= TotalRows){
var titleText = SourcePage.getRange(RowCount,2).getValue();
var urlText = SourcePage.getRange(RowCount,3).getValue();
var postType = SourcePage.getRange(RowCount,4).getValue();
var lineEntry = ('<div>'+titleText+'<THEREISANAHREFHERE="'+urlText+'">'+urlText+'</A></div>');
Logger.log(lineEntry);
Logger.log(pages[1].getTitle());
var page = pages[1].setHtmlContent(lineEntry);
Logger.log(page);
}
}
第 16 行是 'var page = pages[1].setHtmlContent(lineEntry);
日志输出为:
2.0
<div>The new Samsung Galaxy S III Android Smartphone<A HREF="http://www.bbc.co.uk/news/technology-17935684">http://www.bbc.co.uk/news/technology-17935684</A></div>
调试时,页面为“未定义”
任何想法我做错了什么?抱歉,如果格式很差,预览下看起来不错!(Ubuntu 12.04+Chrome)
干杯,
斯莱迪