Hi everyone,I am encountering an issue when users download an Excel file generated from my application. When opening the downloaded file in Microsoft Excel, I get an error as below:
Context / My Implementation:
Has anyone encountered this specific file format error before or know what might be corrupting the output stream?
Any guidance would be greatly appreciated!
Hi @Ameerul Haqim Mohd Isham,
That message means the file is a valid .xlsx but one of its parts is invalid, so the download itself is probably fine. Your flow is also in the right order. Two quick tests will narrow it down:
If you can, please share a small sample .oml that reproduces it. It should contain only the action that builds the file and the template, with any real data removed or replaced by dummy values. Please also tell us which Advanced Excel version you have, and what Excel lists after you click Yes (it names the part it repaired). With that I can reproduce the problem and fix it if it's in the extension.
Hi @Ameerul Haqim Mohd Isham
Your flow order looks correct. Since Excel offers to recover the file, the zip itself is valid and something inside the workbook XML is what Excel doesn't like. In the below way I would pin it down:
Step - 1: Click "Yes" on the recovery prompt. Excel then shows a repair log (e.g. "Removed Feature: Conditional formatting from /xl/worksheets/sheet1.xml"). That tells you exactly which part is broken. Could you share it?
Step - 2: Test with a blank template. Run the same flow using a brand-new, empty .xlsx and a single hardcoded Cell_Write. If it opens cleanly, the problem is the template or the data, not the flow or the download.Step - 3: If the template is the problem, simplify it. Templates with pivot tables, slicers, form controls, external links, complex conditional formatting or data validation often don't survive EPPlus. Remove these one at a time and retest. Also make sure the template is a real .xlsx and not an .xls/.xlsm renamed.Step - 4: Check the values in Cell_Write. Control characters or text longer than 32,767 characters in a cell can corrupt the sheet. This is common with text pasted from Word or PDFs.Step - 5: If the template has formulas, try the Calculate actions before Workbook_GetBinaryData. One similar thread reported errors that disappeared once formulas were evaluated.
Step - 6: Check the Download action. Use the .xlsx file name and the correct MIME type.If you share the repair log and describe what your template contains (pivots, validation, formatting, formulas), it should be easy to narrow down further.Hope this helps! Thanks & Regards,
Sudip Pal