How to upload excel to database by mapping table

Now, my problem is when I import data form excel sheet to the database in particular format. Like,

Table name:-Mytable

id | name | surname | email | date |

and the excel file I am using to import have a same format. But a format can change Like,

id | surname | name | date | email |

how can I map the columns from excel file to the database table so that correct data should enter into the data table.

Typically the first row would hold the column names. You read that and parse the remaining rows accordingly. Parse into a slice of struct, for example, and then handle those appropriately in the database layer.

Would you please provide sample code?

Why don’t you show what you have and where you run into trouble, and we can offer advice on how to proceed.


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.