読者です 読者をやめる 読者になる 読者になる

うまくいかなかったメモ

memo GoogleAppsScript
function getNewDate2_1() {
  var ss = SpreadsheetApp.getActiveSheet();
  
  for(count = 1; count < 8;){
    var startRow1 = count+1;
    var startCol1 = 3;

    var rssUrl = ss.getRange(startRow1,startCol1,1,1).getValue();
    arguments.callee
    
    var advancedArgs = {
      headers: {"User-Agent":"UrlFetchApp(id="+Utilities.base64Encode(Utilities.computeHmacSha256Signature(Session.getUser().getUserLoginId(),ss.getName()))+")"}
    };

    var rssText = UrlFetchApp.fetch(rssUrl,advancedArgs).getContentText();
    var doc = Xml.parse(rssText);
  
    var items = doc.getElement().getElement("channel").getElements("item");
    var titles = new Array();
    var item;

    for(idx = 0; idx < 5;){
      var entryDate = items[idx].getElement("pubDate").getText();
      var NewDate = new Date(entryDate);
      titles.push( [NewDate] );
      idx++;
    }

    var startRow2 = count+1;
    var startCol2 = 4;
    var range = ss.getRange(startRow2, startCol2, 1, 3);
     //(最初の行,最初の列,行数,列数)
    range.setValues(titles);
    
    count++;
  }
}