import xlrd
import pymssql
book=xlrd.open_workbook('新增HS-150.xlsx')
sheet=book.sheet_by_index(0)
host='DESKTOP-0NM3KUS'
user='sa'
password='kw1234'
database='note'
conn=pymssql.connect(host,user,password,database)
cursor = conn.cursor()
sql='insert into Sheet1$(HSCode,类别名称,关税税率,消费税税率,消费税折扣,增值税税率,增值税折扣,监管条件,是否化妆品类别,特殊限制类型)values(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)'
for r in range (1,sheet.nrows):
hscode=sheet.cell(r,0).value
category=sheet.cell(r,1).value
tax1=sheet.cell(r,2).value
xtax=sheet.cell(r,3).value
count1=sheet.cell(r,4).value
ztax=sheet.cell(r,5).value
zcount=sheet.cell(r,6).value
jg=sheet.cell(r,7).value
hzp=sheet.cell(r,8).value
xz=sheet.cell(r,9).value
values=(hscode,category,tax1,xtax,count1,ztax,zcount,jg,hzp,xz)
cursor.execute(sql,values)
cursor.close()
print('all done')
##print('')
##print('done')
##print('')
##col=str(sheet.ncols)
##row=str(sheet.nrows)
#print('i just import %s' %(col) 'col and %s' %(row) 'row to SQL!')))