Read value row by row in cypress from Excel file

Viewed 546

I have a file either with the xlsx or with csv extension from that I want to read data and want to match the data in the excel file. I am new to javascript, cypress & node. I am using read-excel-file plugin to read the excel file. I can read the excel file using it but issue reading in CSV file, Here is the code of my tc

cy.task('readExcelFile', 'filepath/file.csv')
         .should('have.length.gt', 0)
        .then((list) => {
            cy.log(list)
        })

Here is the code of read-file.js & registered in the plugin

const readXlsxFile = require('read-excel-file/node')
const fs = require('fs');
const path = require('path');

const readExcelFile = (filename) => {
  console.log('reading Excel file %s', filename)
  console.log('from cwd %s', process.cwd())
  return readXlsxFile(filename)
}

Now, I am trying to read the CSV file using the same code but getting an error readExcelFile, filepath/file.csv cy.task('readExcelFile') failed with the following error:

invalid signature: 0x646e6556Learn more

0 Answers
Related