C# - How to convert Excel sheet to data table dynamically


I have the excel and i want to convert same structure format as datatable.

for example,

below is my screenshot and output.

The datatable should dynamically generate based on my excel column input.

for example.

if i have 5 excel columns then datatable only A to E,

if i have 3 excel columns then datatable only A to C, like that.

How to do this.??
Ganesh STech Lead cum developerAsked:
Who is Participating?
Dirk StraussConnect With a Mentor Senior Full Stack DeveloperCommented:
Have a look at GemBox.Spreadsheet. There is a free version with some limitations. Here is an article on their site: Create DataTable from Excel sheet in C# and VB.NET.
Ganesh STech Lead cum developerAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.