TypeError: column.equivalentTo is not a function
See original GitHub issueHi,
I have just encoutered this error since yersterday.
Can you please give me the “real reason” of that? What’s happened?
var exportForApp = function (app_id, callback) {
var wb = initializeWorkbook();
var sheet = initializeWorksheet(wb, getSheetTabName());
var headers = getExportHeaders();
formService.findByAppWithGift(app_id, function (err, forms) {
if (err) { callback(true, err); }
else {
for (var i in forms) {
var row = {
gender: forms[i].gender,
first_name: forms[i].first_name,
last_name: forms[i].last_name,
email: forms[i].email,
optin: forms[i].optin,
prize: forms[i].gift_name
};
sheet.addRow(row);
}
var filePath = getExportFileName();
var streamFile = fs.createWriteStream(filePath);
streamFile.end();
wb.xlsx.writeFile(filePath)
.then(function() {
callback(false, filePath);
})
.catch(function (err) {
console.log(err);
callback(true, err);
});
}
});
}
// returns the export file name
function getExportFileName () {
return format("%s/File-export-%s.xlsx", config.admin.exportStoragePath, moment().format(config.admin.exportDateFormat));
}
// returns the headers
function getExportHeaders () {
return [
{ key: "gender", title: "Civilité" },
{ key: "first_name", title: "Prénom" },
{ key: "last_name", title: "Nom" },
{ key: "email", title: "Email" },
{ key: "optin", title: "Optin newsletter"},
{ key: "prize", title: "Gain" }
];
}
// returns the sheet tab name
function getSheetTabName () {
return "Participants";
}
// intitialize the workbook and return it
function initializeWorkbook () {
var wb = new xls.Workbook();
wb.creator = "LOL";
wb.created = new Date();
wb.modified = new Date();
return wb;
}
// initialize the worksheet and return it
function initializeWorksheet (workbook, name) {
var sheet = workbook.addWorksheet(name);
var headers = getExportHeaders();
sheet.properties.outlineLevelCol = headers.length;
sheet.properties.outlineLevelRow = headers.length > 0 ? 1 : 0;
sheet.columns = [];
for (var i in headers) {
sheet.columns.push({ key: headers[i].key, header: headers[i].title, width: 40, outlineLevel: 1 });
}
return sheet;
}```
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:9
Top Results From Across the Web
writeFile not woking in exceljs - node.js - Stack Overflow
i am using exceljs and try to write value in a cell but it does not working. However workbook.
Read more >TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >TypeError: $(...).DataTable is not a function in jQuery
To solve the "$(...).DataTable is not a function" jQuery error, make sure to load the jQuery library before loading the DataTables library.
Read more >The Worksheet Class — XlsxWriter Documentation
-1: Row or column is out of worksheet bounds. ... NAN and INF are not supported and will raise a TypeError exception unless...
Read more >pandas.DataFrame.nlargest — pandas 1.5.2 documentation
The columns that are not specified are returned as well, but not used for ordering. This method is equivalent to df.sort_values(columns, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@christophedebatz it appears you have to dump the entire columns array into the columns property at once… I was pushing to it inplace before with a for loop… reassigned it into a variable, dumped it in all at once after, and it worked
@LVMuser You can’t use
worksheet.columns.push(x)
.In order to make this work you can only define the columns once. So, to get it to work define a variable with your columns, add the extra ones afterwards and THEN define the columns on your worksheet:
EDIT: atleast I think you can’t use .push(x). Correct me if I’m wrong! Tried it myself but didn’t work, whereas defining it once, like suggested above, works 😃