title: Google Apps script, Invalid argument: Name
body: <p>I have a google site with some scripts running on time triggers. </p>
  
  <p>I have multiple list pages for different users. 
  The script I am using is taking the values from the google sites list page and putting those values in a google sheet. </p>
  
  <p>I am adding a new user and I've copied the code that works for all the previous users and pasted the code for the new user giving it a function name of *UsernameList().</p>
  
  <p>This same code is working for other users but is throwing an error for this one.</p>
  
  <p>Here is the code.</p>
  
  <pre><code>      function nicholsonList() {
  var site = SitesApp.getSiteByUrl('https://sites.google.com/XXXXXXXXXXXXXXXXXXX');
  var page = SitesApp.getPageByUrl("https://sites.google.com/XXXXXXXXXXXXXXXXXXXX");
  
  // setting the google spreadsheet
  var ss = SpreadsheetApp.openById('XXXXXXXXXXXXXXXXXXXXXXX');
  var sheet = ss.getSheetByName("Nicholson");
  
  // setting loggers to confirm information
  Logger.log(site);
  Logger.log(page);
  Logger.log(ss);
  Logger.log(sheet);
  
  
  sheet.getRange('B2:H22').clearContent();
  var items = page.getListItems({ start:0, max: 50 });
  var itemslength = items.length;
  Logger.log(itemslength);
  
  
  var item, attrib = 0;
  var row = 2;
  var attribs = ["", "", "Project", "Description", "Assigned By", "Status", "Start Date", "Due Date", "% Complete", "Job Number", "Comments"];
  
  for (var i in items) { if (items.hasOwnProperty(i)) {
      item = items[i];
      for (var j = 2; j &lt; attribs.length; j++) {
          attrib = item.getValueByName(attribs[j]);
          Logger.log(attrib);
          range = sheet.getRange(row,j)
          var sheetwrite = sheet.setActiveRange(range)
          sheetwrite.setValue(attrib); 
      }
  
    Logger.log(row);
    Logger.log(j);
    row++; 
  </code></pre>
  
  <p>There is some code preceding that points to the correct site address and google sheet and tab name. </p>
  
  <p>I am getting an error on the following line.</p>
  
  <pre><code>attrib = item.getValueByName(attribs[j]); 
  </code></pre>
  
  <p>The error I am getting is </p>
  
  <blockquote>
    <p>Invalid argument: name (line 286, file "Code")</p>
  </blockquote>
  
  <p>I'm stumped. </p>
  
  <p>I would appreciate any direction you can provide.</p>
  
  <p><strong>EDIT</strong> </p>
  
  <p>I found the issue some time ago but wanted to update this. </p>
  
  <p>A user had deleted some of the columns in the list page so the script was looking for more items than were present.</p>