PyExcelerate icon indicating copy to clipboard operation
PyExcelerate copied to clipboard

Replaced Part: /xl/worksheets/sheet1.xml part with XML error. A document must contain exactly one root element. Line 1, column 0.

Open amzar96 opened this issue 4 years ago • 6 comments

L_FB55 tmp

Here is my code when using PyExcelerate

from pyexcelerate import Workbook
def to_excel(df, path, sheet_name="Documents"):
    data = [
        df.columns.tolist(),
    ] + df.values.tolist()
    wb = Workbook()
    wb.new_sheet(sheet_name, data=data)
    wb.save(path)

I can't debug the error because I do not see any value to search. Does anyone know how to fix this?

amzar96 avatar Oct 19 '20 12:10 amzar96

Do you have a sample dataframe to reproduce the issue?

kevmo314 avatar Oct 19 '20 22:10 kevmo314

Do you have a sample dataframe to reproduce the issue?

I do not know :( I do not have idea why this happen. Before this, I have issue with NULL @ !NUM but already solved. Now this issue come out.

amzar96 avatar Oct 20 '20 00:10 amzar96

Hey @amzar96, you mentioned I have issue with NULL @ !NUM but already solved. Can you please let me know your solution ? I'm looking for a work around too.

sgsaikat avatar Mar 15 '21 04:03 sgsaikat

@sgsaikat do you have a dataframe that you can share to reproduce your issue?

kevmo314 avatar Mar 15 '21 06:03 kevmo314

@kevmo314 Actually, it's not an issue per se. I simply want to replace all the instances of the NULL values with blanks which gets converted to !NUM. In my case, the df.fillna() doesn't work, it errs out.

sgsaikat avatar Mar 15 '21 07:03 sgsaikat

I had the same error, but in my case pyexcelerate worked fine until the file reached 230,000 rows, after that pyexcelerate created the file with no errors in console, but when I tried to open the file Excel showed the error.

Krebell avatar Apr 28 '21 17:04 Krebell