Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read and save excel async is not work #1481

Closed
H0LIXI opened this issue Jun 11, 2024 · 2 comments
Closed

Read and save excel async is not work #1481

H0LIXI opened this issue Jun 11, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@H0LIXI
Copy link

H0LIXI commented Jun 11, 2024

EPPlus usage

Noncommercial use

Environment

Windows10

Epplus version

7.1.x

Spreadsheet application

Excel

Description

I try to read and save excel async.
But the excel was not changed after save.

using (var excel = new ExcelPackage())
{
    await excel.LoadAsync(excelPath);
    var worksheets = excel.Workbook.Worksheets;
    foreach (var sheet in worksheets)
    {
        sheet.Cells[1, 1].Value = DateTime.Now.ToString();
    }

    await excel.SaveAsync();
}

I have provided a simple demo that can reproduce this problem
TestEPPlusAsync.zip

@H0LIXI H0LIXI added the bug Something isn't working label Jun 11, 2024
@JanKallman
Copy link
Contributor

JanKallman commented Jun 11, 2024

The Load/LoadAsync methods will load the file to the Stream without setting the ExcelPackage.File property, so if you use SaveAsync it will only save the workbook to the Stream property. Either set the ExcelPackage.File property to the FileInfo you want to save to or use the SaveAsAsync property.

@H0LIXI
Copy link
Author

H0LIXI commented Jun 12, 2024

The Load/LoadAsync methods will load the file to the Stream without setting the ExcelPackage.File property, so if you use SaveAsync it will only save the workbook to the Stream property. Either set the ExcelPackage.File property to the FileInfo you want to save to or use the SaveAsAsync property.

Thank you for your reply. It works after setting the ExcelPackage.File property

@H0LIXI H0LIXI closed this as completed Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants