We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is it possible to write multiple worksheets in a single file? I can't work out how to do it, tried this:
using (FileStream fs = File.Create(fileName)) { ExcelWriter writer = null; writer = new ExcelWriter(fs, "Sheet1", ci, true); await writer.WriteRecordsAsync(data1); writer = new ExcelWriter(fs, "Sheet2", ci, true); await writer.WriteRecordsAsync(data2); await writer.DisposeAsync(); }
and end up with a workbook with a single sheet "Sheet2"
The text was updated successfully, but these errors were encountered:
Since this is based on CsvHelper, I would guess it isn't possible to do multi-sheet workbooks, but I agree that would be excellent if it could.
Sorry, something went wrong.
You can make it work pretty easily if you copy the ExcelWriter to you project and add a new constructor that takes the Sheet instead of the stream:
public XlsxWriter(IXLWorksheet sheet, CultureInfo currentCulture, int startRow = 1, int startColumn = 1) : this(sheet, new CsvConfiguration(currentCulture), startRow, startColumn) { } public XlsxWriter(IXLWorksheet sheet, CsvConfiguration configuration, int startRow = 1, int startColumn = 1) : base(null, configuration) { _sheet = sheet; row = startRow; this.startColumn = index = startColumn;
No branches or pull requests
Is it possible to write multiple worksheets in a single file? I can't work out how to do it, tried this:
and end up with a workbook with a single sheet "Sheet2"
The text was updated successfully, but these errors were encountered: