deleteColumn = function(columnNumber, numOfColumns) {
    const obj = this;

    // Global Configuration
    if (obj.options.allowDeleteColumn != false) {
        if (obj.headers.length > 1) {
            // Delete column definitions
            if (columnNumber == undefined) {
                const number = obj.getSelectedColumns(true);

                if (! number.length) {
                    // Remove last column
                    columnNumber = obj.headers.length - 1;
                    numOfColumns = 1;
                } else {
                    // Remove selected
                    columnNumber = parseInt(number[0]);
                    numOfColumns = parseInt(number.length);
                }
            }

            // Lasat column
            const lastColumn = obj.options.data[0].length - 1;

            if (columnNumber == undefined || columnNumber > lastColumn || columnNumber < 0) {
                columnNumber = lastColumn;
            }

            // Minimum of columns to be delete is 1
            if (! numOfColumns) {
                numOfColumns = 1;
            }

            // Can't delete more than the limit of the table
            if (numOfColumns > obj.options.data[0].length - columnNumber) {
                numOfColumns = obj.options.data[0].length - columnNumber;
            }

            const removedColumns = [];
            for (let i = 0; i < numOfColumns; i++) {
                removedColumns.push(i + columnNumber);
            }

            // onbeforedeletecolumn
           if (dispatch.call(obj, 'onbeforedeletecolumn', obj, removedColumns) === false) {
              return false;
           }

            // Can't remove the last column
            if (parseInt(columnNumber) > -1) {
                // Merged cells
                let mergeExists = false;
                if (obj.options.mergeCells && Object.keys(obj.options.mergeCells).length > 0) {
                    for (let col = columnNumber; col < columnNumber + numOfColumns; col++) {
                        if (isColMerged.call(obj, col, null).length) {
                            mergeExists = true;
                        }
                    }
                }
                if (mergeExists) {
                    if (! confirm(jSuites.translate('This action will destroy any existing merged cells. Are you sure?'))) {
                        return false;
                    } else {
                        obj.destroyMerge();
                    }
                }

                // Delete the column properties
                const columns = obj.options.columns ? obj.options.columns.splice(columnNumber, numOfColumns) : undefined;

                for (let col = columnNumber; col < columnNumber + numOfColumns; col++) {
                    obj.cols[col].colElement.className = '';
                    obj.headers[col].className = '';
                    obj.cols[col].colElement.parentNode.removeChild(obj.cols[col].colElement);
                    obj.headers[col].parentNode.removeChild(obj.headers[col]);
                }

                const historyHeaders = obj.headers.splice(columnNumber, numOfColumns);
                const historyColgroup = obj.cols.splice(columnNumber, numOfColumns);
                const historyRecords = [];
                const historyData = [];
                const historyFooters = [];

                for (let row = 0; row < obj.options.data.length; row++) {
                    for (let col = columnNumber; col < columnNumber + numOfColumns; col++) {
                        obj.records[row][col].element.className = '';
                        obj.records[row][col].element.parentNode.removeChild(obj.records[row][col].element);
                    }
                }

                // Delete headers
                for (let row = 0; row < obj.options.data.length; row++) {
                    // History
                    historyData[row] = obj.options.data[row].splice(columnNumber, numOfColumns);
                    historyRecords[row] = obj.records[row].splice(columnNumber, numOfColumns);
                }

                for (let i = columnNumber; i < obj.cols.length; i++) {
                    obj.cols[i].x = i;
                }

                for (let j = 0; j < obj.records.length; j++) {
                    for (let i = columnNumber; i < obj.records[j].length; i++) {
                        obj.records[j][i].x = i;
                    }
                }

                // Delete footers
                if (obj.options.footers) {
                    for (let row = 0; row < obj.options.footers.length; row++) {
                        historyFooters[row] = obj.options.footers[row].splice(columnNumber, numOfColumns);
                    }
                }

                // Remove selection
                conditionalSelectionUpdate.call(obj, 0, columnNumber, (columnNumber + numOfColumns) - 1);

                // Adjust nested headers
                if (
                    obj.options.nestedHeaders &&
                    obj.options.nestedHeaders.length > 0 &&
                    obj.options.nestedHeaders[0] &&
                    obj.options.nestedHeaders[0][0]
                ) {
                    for (let j = 0; j < obj.options.nestedHeaders.length; j++) {
                        const colspan = parseInt(obj.options.nestedHeaders[j][obj.options.nestedHeaders[j].length-1].colspan) - numOfColumns;
                        obj.options.nestedHeaders[j][obj.options.nestedHeaders[j].length-1].colspan = colspan;
                        obj.thead.children[j].children[obj.thead.children[j].children.length-1].setAttribute('colspan', colspan);
                    }
                }

                // Keeping history of changes
                setHistory.call(obj, {
                    action:'deleteColumn',
                    columnNumber:columnNumber,
                    numOfColumns:numOfColumns,
                    insertBefore: 1,
                    columns:columns,
                    headers:historyHeaders,
                    cols:historyColgroup,
                    records:historyRecords,
                    footers:historyFooters,
                    data:historyData,
                });

                // Update table references
                updateTableReferences.call(obj);

                // Delete
                dispatch.call(obj, 'ondeletecolumn', obj, removedColumns);
            }
        } else {
            console.error('Jspreadsheet: It is not possible to delete the last column');
        }
    }
}
Delete a column by number

@param integer columnNumber - reference column to be excluded
@param integer numOfColumns - number of columns to be excluded from the reference column
@return void