Many people will be facing problems in converting the Excel data to MySQL Table data. This week I came across this tool and found helpful for every one. It is simply superb.
The steps to export your Excel data to MySQL table is below,
For export as a New table data,
- Open the excel sheet from where you want to export data
- Go to Data tab, then click MySQL for Excel
- Make sure database server is running. Click on new connection down the page and fill all the details
- Double click on the connection under Local/Remote connections to open the connection and enter password.This lists all the schema under the connection
- Double click on the schema to open
- Now select the value to export
- Now the export option will be enabled on the right side
- Click on export Excel data to new table
- A pop opens where it asks for the table name and primary keys
- Just follow those steps and click on export.
- Table is created under the schema, with the table name you entered.
You may feel this is very easy. Now the interesting thing comes. This is what i required and it took me one day to figure it out.
What happens if you want one column of the excel data to be exported to one Column of the table??. Here the most important thing is you have to follow the synchronization. Even if you are exporting one column the row should be in sync. For example Salary of Siva should match Salary of Siva in table. You should mesh up the data.
The steps are below.
- Follow till the 5th step above.
- Click the table(example test) to which you want to export the data from excel sheet.
- Click on Edit MySQL data
- This opens the table in a separate sheet with the name of the table(test). Suppose this table has 2 columns named 'A' and 'B' .
- There is excel sheet named newtestdata.xls, and it has 2 columns named 'A' and 'B' .
- Now we wanted to move the newtestdata.xls 's 'B' column to test table.
- First make sure, newtestdata.xls's 'B' column and test sheet's 'B' columns are following same order.
- then check whether the sheet is editable. If not,
- press ALT + f11
- double click the sheet where the table to be edited is shown. (Test sheet)
- copy the below code on the white space
Sub PasswordBreaker()
'Breaks worksheet password protection.
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126
ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
If ActiveSheet.ProtectContents = False Then
MsgBox "One usable password is " & Chr(i) & Chr(j) & _
Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
Exit Sub
End If
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
End Sub - press f5
- now the column will be editable on sheet test.
- copy the data inside column 'B'.
- press commit changes.
Thats all. The changes are now committed to database.
No comments:
Post a Comment