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

Add method to get worksheet names in the same order they appear in excel (for review/comments only) #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RyanDansie
Copy link

This provides a method GetWorksheetNamesOrdered() to return the worksheet names in the same order as they would appear in excel.

Works by extracting the contents of the excel file, finding the XML file containing the worksheet names and parsing the XML contents of that file. I found the necessary information about the xlsx file format from this stack overflow answer:
http://stackoverflow.com/a/19930386/2617732

Using the test excel files, the new method works fine with the xlsm and xlsx files. It also works with csv by returning an empty list. It doesn't work for the xls and xlsb files as they have a different format. If anybody knows where the same worksheet information could be found within an xls file, please comment on here.

Notes:

  1. Requires the project to use v4.5 .net framework
  2. Requires a reference to System.IO.Compression
  3. This doesn't have any dependencies within this project so even if its unsuitable for merging, its still potentially useful as a standalone function i.e. to offer a workaround to people that need the ordering of worksheets.

@paulyoder
Copy link
Owner

Thanks for the pull request @RyanDansie!

I would like to keep the .Net framework dependency at v3.5 if possible, so do you know the reason to require v4.5? I might be convinced to upgrade the dependency to 4.5, but I want to make sure it's worth while.

@RyanDansie
Copy link
Author

.net 4.5 is for the one line unzip of the xlsx file (ZipArchive class). I'm sure I could change that part to use DeflateStream.

@paulyoder
Copy link
Owner

If it's not too hard to use DeflateStream, that would be great. If it requires more work, then I could go ahead and create version 2.0 of LinqToExcel and make it depend on .Net 4.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants