C
C#16mo ago
Livid

✅ Excel

how do i read a excel file / table
35 Replies
Jimmacle
Jimmacle16mo ago
$excel
MODiX
MODiX16mo ago
ClosedXML 0.102.1
See release notes https://github.com/ClosedXML/ClosedXML/releases/tag/0.102.1 ClosedXML is a .NET library for reading, manipulating and writing Excel 2007+ (.xlsx, .xlsm) files. It aims to provide an intuitive and user-friendly interface to dealing with the underlying OpenXML API.
Livid
LividOP16mo ago
i can't use that
Jimmacle
Jimmacle16mo ago
ok without information i can't give a good suggestion
Livid
LividOP16mo ago
i can't have references in my project
Jimmacle
Jimmacle16mo ago
why? because basically any excel editing/interop is going to be a library you need to reference you are talking about .xlsx files, right? not csv/tsv/some other plaintext format?
Livid
LividOP16mo ago
yes xlsx
Jimmacle
Jimmacle16mo ago
so you need to reference a library unless you plan on implementing your own XLSX manipulation library (which is a terrible idea)
Livid
LividOP16mo ago
i only really need to read contents
Jimmacle
Jimmacle16mo ago
you still need code that understands the file format so your options are to write it or use someone else's what is the reason you can't have references?
Livid
LividOP16mo ago
the program i'm using doesn't support it
Jimmacle
Jimmacle16mo ago
aren't you writing the program? please provide enough detail in your question that we can help you
Livid
LividOP16mo ago
need to read a excel file - but can't use references / libary
Jimmacle
Jimmacle16mo ago
you're kinda out of luck then
MarkPflug
MarkPflug16mo ago
ClosedXML is MIT open source. If you "can't have references" then you can copy all the source code into your project. But, that would also be idiotic if you can use it a nuget package reference instead.
Jimmacle
Jimmacle16mo ago
i feel like "can't have references" suggests there is a lot more context that isn't being shared
MarkPflug
MarkPflug16mo ago
Indeed. Or the questioner is trying to obscure something in their work.
Jimmacle
Jimmacle16mo ago
well, until that context is given there's nothing else we can suggest
MarkPflug
MarkPflug16mo ago
Anyway... the answer to "how to read an .xlsx" is fully "described" by any number of open source libraries: ClosedXml, ExcelDataReader, NPOI, MiniExcel, FastExcel, Sylvan.Data.Excel (the one I wrote), or one of many others.
MarkPflug
MarkPflug16mo ago
How easy they are to use is up to you to decide, but I've measured the performance of most of them: https://github.com/MarkPflug/Benchmarks/blob/main/docs/ExcelReaderBenchmarks.md#excel-xlsx-benchmarks
GitHub
Benchmarks/docs/ExcelReaderBenchmarks.md at main · MarkPflug/Benchm...
Benchmarks for various .NET libraries. Contribute to MarkPflug/Benchmarks development by creating an account on GitHub.
Livid
LividOP16mo ago
what more context?
Jimmacle
Jimmacle16mo ago
i've asked several times why can't you use libraries?
Livid
LividOP16mo ago
the application i'm using doesn't support it
Jimmacle
Jimmacle16mo ago
you already said that what application? how does your code interact with it?
Livid
LividOP16mo ago
hmm wait so i can't install anything into my project
Jimmacle
Jimmacle16mo ago
but why? i'm trying to help you find solutions here, make it easy for me
Livid
LividOP16mo ago
yes sorry
Livid
LividOP16mo ago
these are the only options for my project :(
No description
Jimmacle
Jimmacle16mo ago
what application is this?
Livid
LividOP16mo ago
company's
Jimmacle
Jimmacle16mo ago
your company has a custom in-house IDE?
Livid
LividOP16mo ago
yes
Jimmacle
Jimmacle16mo ago
i guess you're out of luck then your best option would be to copy and paste the source code from a library that permits that kind of usage like MarkPflug suggested or ask someone at your company for help
GaSkia
GaSkia16mo ago
Have u added the assembly? Can u send the using part with the error
Jimmacle
Jimmacle16mo ago
read above, he's using some special editor his company made that doesn't allow project/assembly references

Did you find this page helpful?