Search code examples
pythonexcelxlrdxlsxwriter

How to count the number of rows in an Excel document in xlsxwriter


does anyone know how to count the number of rows on an Excel worksheet using xlsxwriter? I have looked for a method similar to XLRD's worksheet.nrows in xlsxwriter but have not been able to find one. I had orginally tried to use both xlsxwriter and xlrd in a script but I have errors due to what I think is a problem with both xlsxwriter and xlrd trying to open the same file at the same time. I can attach the code if that would help. Thank you very much in advance!


Solution

  • xlsxwriter does not support reading from a workbook. It is designed to create excel workbooks.

    From their site: https://xlsxwriter.readthedocs.org/en/latest/introduction.html

    It cannot read or modify existing Excel XLSX files.