In this video I demonstrate how to create a Python script that will import data from Excel into MySQL using the xlrd library. Blog article - mherman.org/blo...
Thanks Michael for this great tutorial was really helpful. I think it's only one so far as i was looking for awhile . It's just to unzip/ install xlrd wasn't so simple, had to look for other tutorials
Thanks, for putting this vid up. I learned a bunch. I'll look through your other vids to see how I can create and use a config file to hide the database properties as well as the path for the *.xls file.
Hi Michael, Found and teased out an explanation. 1. Unzip anywhere, then copy the new folder into the Python folder, mine is C://Python27 2. Open a cmd prompt and type cd/ to get back to C:\>: 3. Then cd/Python27/xlrd-0.8.0 Enter (if your Python is in the C:/ folder, most are). 4. Then setup.py. build Enter 5. Then setup.py install Enter That's it, plus the method should work for any add in for Python. Substiute your folder name for your version of Python. Please Pass ON. Thank you.
Fantastic expanation Michael, I love your calm manner, dignified too. I have been hoping to try the excel to mysql out but can't get xlrd to be available to python. I've tried all the google searches and tried their suggestion but still it wont import xlrd Could you help, perhap list how to install or compile the download into python, thank you Victor
This is awesome, any way to search an entire folder for excel sheets, rather than naming a specific doc? I use cron to download new excel docs everyday, with random names, so I can really do it file by file. Any help would be much appreciated!
hello, I just saw u r video but, I have a doubt actually, why did u use( nrows) in for loop,when I am trying u code, I am getting an attribute error, could u please tell me the reason , thanku
Hi Michael, Thank you for the video but it's not working for me yet. I get an error for the c.execute(query, values') statement and I can't see the problem is. Any insights are greatly appreciated.
Michael, Yes, but for what I can see there is no explanation on how to install. When unpacked from the zip file to a location on my desktop, I tried running 'setup.py', That bring up errors associated with __file__ not being named. I then give that a path value 'Python27' then ''Python27\include" then "Python27\include\xlrd" +back slashes different ways. I can't find a clear method of how to install please help I also copied the downloaded xlrd files to where Python27 is on my computer.
Nice video, thx :-D I have a question nonetheless. I am kind of a newb, so please be patient :-). How would you import an excel to MySQL with a db that has more than one table? For e.g.: 1. I have the following tables: person, job, country 2. person and job are many2many (1 person can have many jobs, and vice-versa) 3. country is 1 to many (1 country can have many people in it) How can I run the queries to enter the excel row (person, job, country) while insuring the above stated relationships? Thank you so much for your help :-) and keep up the nice vids! Jonathan
Thank you Michael! I love the way you organize and pseudo code your plan beforehand. It helps a lot when trying to follow along! Great tutorial!
Fantastic. It's the first time I see someone starts the code with only comments. I might start doing this too.
Your voice is so relaxing! I am watching your video to see if it can help me with my assignment. Hopefully it does.
Thanks Michael for this great tutorial was really helpful. I think it's only one so far as i was looking for awhile . It's just to unzip/ install xlrd wasn't so simple, had to look for other tutorials
Thanks, for putting this vid up. I learned a bunch. I'll look through your other vids to see how I can create and use a config file to hide the database properties as well as the path for the *.xls file.
You just saved me lots of headache. Thanks
thank you.. you saved my life T_T
Thank you for the easy to follow video. This worked perfectly for me.
Hi Michael,
Found and teased out an explanation.
1. Unzip anywhere, then copy the new folder into the Python folder, mine is C://Python27
2. Open a cmd prompt and type cd/ to get back to C:\>:
3. Then cd/Python27/xlrd-0.8.0 Enter (if your Python is in the C:/ folder, most are).
4. Then setup.py. build Enter
5. Then setup.py install Enter
That's it, plus the method should work for any add in for Python. Substiute your folder name for your version of Python. Please Pass ON. Thank you.
yes, search for "MySQL for Excel". there is a program directly from oracle that you can use.
Thanks . Really nice video.
great video instructional video. Took me about two day to get it to work but I wouldn't have had any idea without your help. Thanks A lot!!!
Fantastic expanation Michael,
I love your calm manner, dignified too.
I have been hoping to try the excel to mysql out but can't get xlrd to be available to python.
I've tried all the google searches and tried their suggestion but still it wont import xlrd
Could you help, perhap list how to install or compile the download into python,
thank you
Victor
This is awesome, any way to search an entire folder for excel sheets, rather than naming a specific doc? I use cron to download new excel docs everyday, with random names, so I can really do it file by file. Any help would be much appreciated!
hello, I just saw u r video but, I have a doubt actually, why did u use( nrows) in for loop,when I am trying u code, I am getting an attribute error, could u please tell me the reason , thanku
Thank you so much! Very helpful for my uni project
Great tutorial
Is it possible to output the number of imported rows and columns to say a text file ?
@Michael I am getting the following error %d format: a number is required
Instead of using Excel, can I do the same but with CSV file?
Can we import in quickbase through this method
Hi Michael, Thank you for the video but it's not working for me yet. I get an error for the c.execute(query, values') statement and I can't see the problem is. Any insights are greatly appreciated.
Hi Michael I have a problem which is cell() takes exactly 3 arguments (2 given)
Michael,
Yes, but for what I can see there is no explanation on how to install.
When unpacked from the zip file to a location on my desktop, I tried running 'setup.py',
That bring up errors associated with __file__ not being named.
I then give that a path value 'Python27' then ''Python27\include" then "Python27\include\xlrd" +back slashes different ways.
I can't find a clear method of how to install please help
I also copied the downloaded xlrd files to where Python27 is on my computer.
Help me with suffled excel sheet columns and compare column name and update database
Nice video, thx :-D
I have a question nonetheless. I am kind of a newb, so please be patient :-).
How would you import an excel to MySQL with a db that has more than one table?
For e.g.:
1. I have the following tables: person, job, country
2. person and job are many2many (1 person can have many jobs, and vice-versa)
3. country is 1 to many (1 country can have many people in it)
How can I run the queries to enter the excel row (person, job, country) while insuring the above stated relationships?
Thank you so much for your help :-) and keep up the nice vids!
Jonathan
hey the dates are showing in number format in your video after you have executed it.
thank's yor example is simple and very powerful
Thank you.
Have you tried python-excel (dot) org ?
Great vid :)
Really helped me.
exactly-
1) download and unzip
2) Open Command Prompt
3) CD to the working
4) Run command -
python setup.py install
Can I ask if there is a chinese content in excel ,how to insert in the phpmyadmin??
Congratulations on the video, your teaching is sensational! Hello, could you teach me how to inject an xlsx file? thank you!
Not sure what you mean by "inject an xlsx file"... ?
My output says 'list' object has no attribute 'value'.
What do I do??
Zabardast!
Thanks
Please share the video how to create a db? and the 2nd video. thanks
Does this work for sqlite3?
+Quan N Hey Quan,
do you know how to import Excel into a sqlite ?
+Tho Scho www.saltycrane.com/blog/2007/11/migrating-excel-to-sqlite-using-python/
+Michael Herman Thanks,
but i think the win32com does not work with python2.7 :/
+Tho Scho it does
working directory*
I use easy_install myself. I'll throw up a video of easy_install today or tomorrow.