0

I'm new to Cypress, I want to know how to write data to xlsx file, I tried writing this way but it can't open xlsx file.

cy.writeFile('cypress/fixtures/DataTest/login_result.xlsx', '\nUsername : ' + Username + '\n' + '\nPassword : ' + Password + '\n' + '\nExpectedResult : ' + ExpectedResult + '\n' + '\nActualResult : ' + Asresult + '\n' + '\nResult :' + result + '\n').as('writeXlsxFile')
1
  • xlsx file is not just a plain text, so you likely need some JS library to do the hard work for you. At some places, node-xlsx library is mentioned, so perhaps you can have a look into it. Commented Oct 26, 2021 at 7:43

1 Answer 1

1

Consider the extension of the Excel file as xls. For example, in the code below, the word Hello is written in the Excel file

cy.writeFile('cypress/fixtures/Test.xls', 'Hello','UTF-8')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.