✅ data from excel to wpf app
I want to make an application to display the data I need in graphs, etc.
The only problem is that the original data is provided in .xlsx and .xls format
It would be much more convenient for me to work directly with the database, but the condition is to work with files of this type. They have tables with data. How can i read the file when loading such a file and save the data in a convenient form in the application, in a list, for example
For further work, I mean to create graphs, and view data on something by clicking on a conditional Example1 (Where, how much, when, etc.)
Personally, I have thoughts to do it all through the DataGrid, but I almost never worked with it, and it's hard to imagine how to provide data for it in a more convenient form.
There is also an idea just through the ListView, but for this I need to transfer all the data from the Excel file to the list, in this version I can more or less imagine how I can implement this, but the only problem is reading and writing data to the list
13 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
i wanna do this on wpf
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
This is a training project in general, and is specifically needed as a desktop application.
Before that, I did not work directly with Excel data, and therefore I do not know what to do now
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
50\50
This is necessary for some work purposes, and I want to do it as a desktop application separately, it must be integrated into another application that is already working, and therefore I need my own solution
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
The only thing I can say is that the PowerBI option will not work, and in terms of the fact that I want to do it in WPF as a practice for myself, and how to use it later in my work, this is a very narrow application, and I need do it exactly on WPF
I cant speak for how to read a excel file directly, however if your plan is to use a DataGrid element then the DataTable type might be the easiest way to display the data.
For example you can bind to a DataTable directly like this:
And then in the main window code behind:
Here is the full code behind I used for this example incase it also helps (keep in mind if you plan to use a view model its basically the same thing):
thank you, i gonna try this
For reading xlsx files there is a library called ClosedXml, based on OpenXml but a bit easier to use. But if you need to read xls files also it won't work.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.