socialpoint-labs / sheetfu-apps-script

A Google apps scripts ORM to manipulate spreadsheets as database tables.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

2nd version of sheetfu fails to load with error

JJKW1984 opened this issue · comments

TypeError: Cannot find function Table in object [object Object]. (line 28, file "macros")Dismiss

Please show your code.

function readScheduleByDayTable() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  Sheetfu.Table();
  /* TODO change hard coded values to allows for different tables */
  var sheetName = "scheduleByDay";
  
  var cs = ss.getSheetByName(sheetName);
  var headerRow = 1;
  var table = getTable(sheetName, headerRow, 'staffName');
  
  for (var i = 0; i < table.items.length; i ++) {
      var item = table.items[i];
      // This will print in gas console the first name of everyone in the Table.
      Logger.log(item.getFieldValue("date"), item.getFieldValue("staffName"));    
    }
};

You forgot to reference the Sheetfu library when you get the table. In your code would be:

var table = Sheetfu.getTable(sheetName, headerRow, 'staffName');

It looks like there is indeed a problem with version 2.
Let me look into it.

This has been sorted. Version 2 has been deleted from the available versions.
Use Version 3 now.