loadData only accepts array of objects or array of arrays (string given)

Tags: #<Tag:0x00007f24a3b3c198>

I have a HoT like this:
function loadhot(parm)
const data = parm;
var conten = document.getElementById(‘gridBodyTableExcel’);
HoT = new Handsontable(conten, {
height: 550,
width: 1400,
colWidths: [80, 170, 50, 80, 90, 170, 70, 150,80,80,80,90,180,100,50],
colHeaders: [
‘Monto Disp’,
‘Fec Desembolso’,
columns: [
{ data: ‘RUC’, validator: rucValido, allowInvalid: true, type: “numeric” },
{ data: ‘RAZON’, type: “text” },
{ data: ‘SERIE’, type: “text” },
{ data: “NUMERO”, type: “text” },
data: ‘FECHA’,
type: “date”,
allowInvalid: false
{ data: ‘GLOSA’, type: “text” },
data: ‘OT’, validator: otValidt, allowInvalid: false, type: “numeric”
title: ‘Clasificador’,
type: ‘dropdown’,
source: [‘2015’, ‘2016’, ‘2017’]
type: “numeric”,
readOnly: true
data: ‘MONTO’,
type: “numeric”
data: ‘SALDO’,
type: “numeric”,
readOnly: true
type: “date”,
allowInvalid: false
//type: { renderer: myAutocompleteRenderer, editor: Handsontable.AutocompleteEditor },
type: ‘autocomplete’,
source: listaTmpUsuario,
strict: false,
options: {
items: 10 //options overrides defaults defined in bootstrap typeahead
data: ‘TIPO’,
type: ‘dropdown’,
source: [‘CONTADO’, ‘CREDITO’]
data: ‘FLAG’,
title: ‘IGV?’,
type: ‘checkbox’

        dropdownMenu: true,
       minSpareRows: 1,
        hiddenColumns: {
            indicators: true
        contextMenu: true,
        multiColumnSorting: true,
        filters: true,
        afterGetColHeader: alignHeaders,
        afterOnCellMouseDown: changeCheckboxCell,
        beforeRenderer: addClassesToRows,
        rowHeaders: true,
        rowHeaderWidth: 22,
        colHeaderHeight: 80,
        manualRowMove: true,
        licenseKey: "non-commercial-and-evaluation"
   var col = HoT.countRows();
   HoT.alter('insert_row', col, 20);

Then the user enters a lot of information, but he needs to remove duplicates by some columns, then summarize the amount of the repeated rows, so I get the data from HoT.LoadData() then call summarize() function , (Removing duplicates) and then send it back to HoT:
$("#btnSummarize").click(function (event) {
var list = summarize();
// HoT: Constant variable for HoT object.

function summarize() {
const data = RemoveEmptyCells(HoT.getData());
const result = data.reduce((acc, curr) => {
const objInAcc = acc.find((o) => o[6] === curr[6] && o[7] === curr[7]);
if (objInAcc) objInAcc[9] += curr[9];
else acc.push( curr);
return acc;
}, []);
return result;

Then it throws an error:
uncaught Error: loadData only accepts array of objects or array of arrays (string given)

The format given by summarize function is something like this:

[[20492496325,“WRSOFT”,“00”,“00”,“12/07/2022”,“f”,62228,“AR36 COMBUSTIBLE - CREDITO”,100,120,null,“12/07/2022”,“289 Juan Paul Carreño Navarro”,null,null],[20492496325,“WRSOFT”,“1”,“2”,“12/07/2022”,“f”,62228,“AR38 PEAJE IDA”,20,160,null,“12/07/2022”,“289 Juan Paul Carreño Navarro”,null,null]]

Hi @dante.soto

I’m not able to test the code you sent as there are some missing parts. And yes, loadData() method will throw an error if the provided data aren’t array of object or array of arrays.

Hey @dante.soto

Do you have any updates on the subject? Does it work well now?