Import data from Excel into MySQL using Python

Поделиться
HTML-код
  • Опубликовано: 16 окт 2024
  • 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...

Комментарии • 47

  • @troyke
    @troyke 2 года назад

    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!

  • @georgewang7770
    @georgewang7770 5 лет назад

    Fantastic. It's the first time I see someone starts the code with only comments. I might start doing this too.

  • @Zully0917
    @Zully0917 4 года назад

    Your voice is so relaxing! I am watching your video to see if it can help me with my assignment. Hopefully it does.

  • @simonasopagaite
    @simonasopagaite 8 лет назад +5

    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

  • @stanc846
    @stanc846 6 лет назад

    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.

  • @profmcdan
    @profmcdan 6 лет назад +2

    You just saved me lots of headache. Thanks

  • @anisacaturwahyuni179
    @anisacaturwahyuni179 3 года назад

    thank you.. you saved my life T_T

  • @epremeaux
    @epremeaux 5 лет назад

    Thank you for the easy to follow video. This worked perfectly for me.

  • @princing
    @princing 12 лет назад

    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.

  • @hermanmu
    @hermanmu  11 лет назад

    yes, search for "MySQL for Excel". there is a program directly from oracle that you can use.

  • @rahultakle12
    @rahultakle12 4 года назад

    Thanks . Really nice video.

  • @tjthigpen2
    @tjthigpen2 9 лет назад

    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!!!

  • @princing
    @princing 12 лет назад

    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

  • @zakweinberg
    @zakweinberg 10 лет назад

    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!

  • @dineshsanthu7088
    @dineshsanthu7088 3 года назад

    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

  • @harithajayagopi6820
    @harithajayagopi6820 6 лет назад

    Thank you so much! Very helpful for my uni project

  • @johnsmith-wl1ut
    @johnsmith-wl1ut 7 лет назад

    Great tutorial
    Is it possible to output the number of imported rows and columns to say a text file ?

  • @mariafrancis2268
    @mariafrancis2268 4 года назад

    @Michael I am getting the following error %d format: a number is required

  • @kimdang3556
    @kimdang3556 5 лет назад

    Instead of using Excel, can I do the same but with CSV file?

  • @DevendraSingh-tx2pt
    @DevendraSingh-tx2pt 4 года назад

    Can we import in quickbase through this method

  • @annacrusio1761
    @annacrusio1761 7 лет назад

    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.

  • @sindakhenine3477
    @sindakhenine3477 5 лет назад

    Hi Michael I have a problem which is cell() takes exactly 3 arguments (2 given)

  • @princing
    @princing 12 лет назад

    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.

  • @pixelbro4299
    @pixelbro4299 5 лет назад

    Help me with suffled excel sheet columns and compare column name and update database

  • @jonathansitruk9795
    @jonathansitruk9795 9 лет назад

    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

  • @varunmahale5358
    @varunmahale5358 6 лет назад

    hey the dates are showing in number format in your video after you have executed it.

  • @mahmoudasy1987
    @mahmoudasy1987 5 лет назад

    thank's yor example is simple and very powerful

  • @hermanmu
    @hermanmu  12 лет назад

    Thank you.
    Have you tried python-excel (dot) org ?

  • @ryderr9541
    @ryderr9541 8 лет назад

    Great vid :)
    Really helped me.

  • @hermanmu
    @hermanmu  12 лет назад

    exactly-
    1) download and unzip
    2) Open Command Prompt
    3) CD to the working
    4) Run command -
    python setup.py install

  • @玄律
    @玄律 3 года назад

    Can I ask if there is a chinese content in excel ,how to insert in the phpmyadmin??

  • @evandroluis8783
    @evandroluis8783 5 лет назад

    Congratulations on the video, your teaching is sensational! Hello, could you teach me how to inject an xlsx file? thank you!

    • @hermanmu
      @hermanmu  5 лет назад

      Not sure what you mean by "inject an xlsx file"... ?

  • @engineeringflicks4763
    @engineeringflicks4763 5 лет назад

    My output says 'list' object has no attribute 'value'.
    What do I do??

  • @nitinupadhyay9193
    @nitinupadhyay9193 6 лет назад

    Zabardast!

  • @sreeramanantha5437
    @sreeramanantha5437 4 года назад

    Thanks

  • @tariqhassan3194
    @tariqhassan3194 6 лет назад

    Please share the video how to create a db? and the 2nd video. thanks

  • @RicoGuapoSuave
    @RicoGuapoSuave 9 лет назад

    Does this work for sqlite3?

    • @thoscho7452
      @thoscho7452 8 лет назад

      +Quan N Hey Quan,
      do you know how to import Excel into a sqlite ?

    • @hermanmu
      @hermanmu  8 лет назад

      +Tho Scho www.saltycrane.com/blog/2007/11/migrating-excel-to-sqlite-using-python/

    • @thoscho7452
      @thoscho7452 8 лет назад

      +Michael Herman Thanks,
      but i think the win32com does not work with python2.7 :/

    • @hermanmu
      @hermanmu  8 лет назад

      +Tho Scho it does

  • @hermanmu
    @hermanmu  12 лет назад

    working directory*

  • @hermanmu
    @hermanmu  12 лет назад

    I use easy_install myself. I'll throw up a video of easy_install today or tomorrow.