← Back to Discord Forum

How to Read data from a downloaded excel to verify the contents in Playwright?

Hi team, My requirement is after I download a file using Playwright, I would like to verify the contents from the downloaded file. How would I achieve that using Playwright?

This thread is trying to answer question "How can I read and verify the contents of a downloaded .xlsx file using Playwright?"

12 replies

Depends on what type of file it is but most likely you will need 3rd party library for that

The file type is .xlsx. I tried using the SheetJS library but it did not work. Could you assist me in this ?


🤷‍♀️ don't have experience with such files, but there should be more libs to parse it


@qb1225 I used xlsx for that.

@patrickdoering Could you specify the name of the library?

yes, this is the exact one which I used. However, I am getting the error that File cannot be open

@patrickdoering Have you encountered such issue while trying to readFile


Nope it worked fine for me.

okay, thank you @patrickdoering


That is how my code looks like:

const workbook = xlsx.readFile(filePath);  
let workbook_sheet = workbook.SheetNames;               
let workbook_response = xlsx.utils.sheet_to_json(        
const excelString = JSON.stringify(workbook_response);

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.