Edit Python script from MySQL to MSSQL -


i have script copies data excel mysql using python. need adjust script can move data excel mssql in windows environment. please find script below:

import openpyxl import os import pymysql mdb import locale locale.setlocale(locale.lc_all, 'english-us')  def read_excel(fname=r'c:\\users\\parasystems limited\\desktop\\mail.xlsx'): masterdict = {} wb = openpyxl.load_workbook(fname) sheet in wb:     arow in range(2, sheet.max_row+1):         if sheet['a'+str(arow)].value:             if not sheet['e'+str(arow)].value:                 serialnumber = 0             else:                 serialnumber = sheet['e'+str(arow)].value             masterdict[sheet['a'+str(arow)].value] = {                 'equipment number':sheet['b'+str(arow)].value,                 'description':sheet['c'+str(arow)].value,                 'manufacturer':sheet['d'+str(arow)].value,                 'serial number':serialnumber,                 'country  of manufacturer':sheet['f'+str(arow)].value,                 'functional location description':sheet['g'+str(arow)].value,                 'functional location number (short)':sheet['h'+str(arow)].value,                 'functional location number':sheet['i'+str(arow)].value,                 'cost of servicing , maintenance':sheet['j'+str(arow)].value,                 'office location':sheet['k'+str(arow)].value             } 

this part of it.

please note: tried downloading pymssql package got error message need install microsoft visual c++ 14.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -