Python – Import XLSX to SQL file
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /home/reshajt1/public_html/wp-includes/category.php on line 378
Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /home/reshajt1/public_html/wp-includes/category.php on line 379
Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /home/reshajt1/public_html/wp-includes/category.php on line 380
Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /home/reshajt1/public_html/wp-includes/category.php on line 381
Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /home/reshajt1/public_html/wp-includes/category.php on line 382
Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /home/reshajt1/public_html/wp-includes/category.php on line 383
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /home/reshajt1/public_html/wp-includes/category.php on line 378
Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /home/reshajt1/public_html/wp-includes/category.php on line 379
Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /home/reshajt1/public_html/wp-includes/category.php on line 380
Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /home/reshajt1/public_html/wp-includes/category.php on line 381
Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /home/reshajt1/public_html/wp-includes/category.php on line 382
Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /home/reshajt1/public_html/wp-includes/category.php on line 383
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /home/reshajt1/public_html/wp-includes/category.php on line 378
Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /home/reshajt1/public_html/wp-includes/category.php on line 379
Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /home/reshajt1/public_html/wp-includes/category.php on line 380
Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /home/reshajt1/public_html/wp-includes/category.php on line 381
Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /home/reshajt1/public_html/wp-includes/category.php on line 382
Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /home/reshajt1/public_html/wp-includes/category.php on line 383
excel, mysql, Python
Deprecated: Creation of dynamic property WP_Block::$attributes is deprecated in /home/reshajt1/public_html/wp-includes/class-wp-block.php on line 179
Deprecated: Creation of dynamic property WP_Block::$attributes is deprecated in /home/reshajt1/public_html/wp-includes/class-wp-block.php on line 179
Deprecated: Implicit conversion from float 1789176899.430226 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Creation of dynamic property IRP_HTMLContext::$isParentTable is deprecated in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/html/HTMLContext.php on line 53
Deprecated: Implicit conversion from float 1789176899.430414 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430456 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430481 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430503 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430524 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430582 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430608 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430629 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430649 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.43067 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.43069 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430711 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430733 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430763 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430781 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430804 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.43085 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430875 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430893 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430912 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430936 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430967 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.430985 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431005 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431024 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431048 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431072 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431091 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431108 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431125 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431143 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.43116 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431176 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431193 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431211 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431232 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431266 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431283 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.4313 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431319 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431345 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.43137 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431388 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431406 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431425 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431457 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431485 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431517 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431534 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431552 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431577 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431605 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431627 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431644 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431661 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.43168 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431703 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431729 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431752 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431772 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431789 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431813 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.43184 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431867 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431886 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431903 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.43192 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431939 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431956 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431972 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.431988 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432006 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432025 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432043 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.43206 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432079 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432101 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432118 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432135 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432151 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432169 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432188 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432209 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432226 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432242 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.43226 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432277 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432292 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432309 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432326 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432346 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432367 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432383 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432404 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432426 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.432465 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.43251 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.433098 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Deprecated: Implicit conversion from float 1789176899.433502 to int loses precision in /home/reshajt1/public_html/wp-content/plugins/intelly-related-posts/includes/classes/utils/Logger.php on line 93
Selamat datang di blog saya. Kali ini saya akan membagikan tutorial bagaimana cara untuk import file xlsx untuk masuk ke query sql kita. kita membutuhkan 2 module yang di butuhkan untuk membuat script tersebut yaitu :
- xlrd
- mysqldb
Disini saya mempunyai sebuah file dengan format xls dengan nama “Test.xls”. Berikut isi file tersebut :

Jangan lupa membuat Database dengan Table yang sesuai dengan file nya. Seperti ini :

Nah sekarang kita buat script untuk bisa konek ke database kita. disini saya menggunakan mysql sebagai databasenya, jadi saya menggunakan module MySQLdb sebagai connector nya. jika anda menggunakan database lain, anda bisa mencari module database connector nya.
import MySQLdb as sql
db = sql.connect(host="localhost", user="root",passwd="123", db="excel")
curs = db.cursor()
query = """ INSERT INTO belajar(id,nama,kelas,alamat) VALUES (%s,%s,%s,%s)"""
Kemudian untuk mengimport file xls nya kalian harus menambahkan module xlrd. xlrd hanya bisa menggunakan file dengan exstensi ‘.xls’ saja. Anda tidak bisa import file seperti ‘.xlsx’,’.csv’ atau file excel lainnya.
import xlrd
book = xlrd.open_workbook("Test.xls") #nama file xls nya
sheet = open.sheet_by_name('Test') #nama sheet excel
Nah, tinggal kita gabungin terus pake looping buat masukin datanya. Untuk full script nya bisa di lihat disini atau mendownload nya via github :
import xlrd
import MySQLdb as sql
# SQL
db = sql.connect(host="localhost", user="root",passwd="toor", db="excel")
curs = db.cursor()
query = """ INSERT INTO belajar(id,nama,kelas,alamat) VALUES (%s,%s,%s,%s)"""
# XLS File
book = xlrd.open_workbook("Test.xls") #nama file xls nya
sheet = book.sheet_by_name('Test') #nama sheet excel
#Execute
for n in range(1,sheet.nrows):
id = sheet.cell(n,0).value
nama = sheet.cell(n,1).value
kelas = sheet.cell(n,2).value
alamat = sheet.cell(n,3).value
values = (id,nama,kelas,alamat)
curs.execute(query,values)
curs.close
db.commit()
print("Anda telah berhasil Import !!!")
Silahkan jika anda ingin mendownload source Code nya. Bisa di ambil di akun saya.
https://github.com/ReshaJTama/xlstosql
Anda dapat mengunjungi source tutorial ini di
https://mherman.org/blog/import-data-from-excel-into-mysql-using-python/