C
C#2y ago
Livid

✅ Excel

how do i read a excel file / table
35 Replies
Jimmacle
Jimmacle2y ago
$excel
MODiX
MODiX2y 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
LividOP2y ago
i can't use that
Jimmacle
Jimmacle2y ago
ok without information i can't give a good suggestion
Livid
LividOP2y ago
i can't have references in my project
Jimmacle
Jimmacle2y 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
LividOP2y ago
yes xlsx
Jimmacle
Jimmacle2y ago
so you need to reference a library unless you plan on implementing your own XLSX manipulation library (which is a terrible idea)
Livid
LividOP2y ago
i only really need to read contents
Jimmacle
Jimmacle2y 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
LividOP2y ago
the program i'm using doesn't support it
Jimmacle
Jimmacle2y ago
aren't you writing the program? please provide enough detail in your question that we can help you
Livid
LividOP2y ago
need to read a excel file - but can't use references / libary
Jimmacle
Jimmacle2y ago
you're kinda out of luck then
MarkPflug
MarkPflug2y 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
Jimmacle2y ago
i feel like "can't have references" suggests there is a lot more context that isn't being shared
MarkPflug
MarkPflug2y ago
Indeed. Or the questioner is trying to obscure something in their work.
Jimmacle
Jimmacle2y ago
well, until that context is given there's nothing else we can suggest
MarkPflug
MarkPflug2y 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
MarkPflug2y 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
LividOP2y ago
what more context?
Jimmacle
Jimmacle2y ago
i've asked several times why can't you use libraries?
Livid
LividOP2y ago
the application i'm using doesn't support it
Jimmacle
Jimmacle2y ago
you already said that what application? how does your code interact with it?
Livid
LividOP2y ago
hmm wait so i can't install anything into my project
Jimmacle
Jimmacle2y ago
but why? i'm trying to help you find solutions here, make it easy for me
Livid
LividOP2y ago
yes sorry
Livid
LividOP2y ago
these are the only options for my project :(
No description
Jimmacle
Jimmacle2y ago
what application is this?
Livid
LividOP2y ago
company's
Jimmacle
Jimmacle2y ago
your company has a custom in-house IDE?
Livid
LividOP2y ago
yes
Jimmacle
Jimmacle2y 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
GaSkia2y ago
Have u added the assembly? Can u send the using part with the error
Jimmacle
Jimmacle2y 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?