Have you ever encountered a situation where you had to import records from an Excel file to your database in MySQL?
Once, I found myself at this point, I was confused for a few minutesπ’ but then I decided to consult my knowledgeable friend, Googleπ.
Here I'll describe a step-by-step process to achieve this successfully.
SECTION 1
(Saving the file as a CSV document).
Open the Excel file and then select 'File', a dropdown will appear and then you click 'SaveAs'.
Fill in the name of the document and for the document type, Save it as (comma separated) or (comma delimited) which must have an extension of '.csv'.
SECTION 2
(Importing the CSV file to the database).
It is optional to fill in the table name and if you don't, the name of the file will be the table name.
If the first line of the file contains the table column names check that box (if it is unchecked, the first line will become part of the data).
Leave every other setting at the default unless there is a need to change it.
At the bottom right corner, Select Go. Then your import is successful if your output is similar to this without any query error.
NB: If you had multiple sheets that you saved as CSV documents you import each of them repeating the above process. They will constitute the different tables in your database.
Hurray!π It's simple and awesome right!
Conclusion
These tips are in my own opinion, so if you have a conflicting view or a better approach, kindly drop them in the comment box, I really enjoy learning.
Thanks for reading.π€
Top comments (1)
Nice read π―π―