MySQL Forums
Forum List  »  MySQL for Excel

Re: How to upload Excel spreadsheet to MySQL database
Posted by: Erik Haselhofer
Date: July 20, 2011 03:41PM

It should be as clean as this.

1. Save the worksheet as a .CSV file.
2. Import that into the table which I assume Workbench can handle. I should probably spend more time with it but I was, for whatever reason, never that comfortable with it.

> Should I build a column as a place holder in Excel
> to hold an incremented Id number per data row that
> will upload to MySQL?

You can but you don't have to. You can basically do it as listed below, and, well, a couple more.

Key in Excel
ID
col1
col2
....

Id field at the end of the table and let it populate on the load
col1
col2
ID
.....

Add the ID after you've loaded the data with an ALTER TABLE statement.
col1
col2
......

alter table tableName add id int not null auto_increment primary key.

This assumes you want to start at 1 and increment from there.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: How to upload Excel spreadsheet to MySQL database
1491
July 20, 2011 03:41PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.