import xlrd
from collections import OrderedDict
import json
# Open the workbook and select the first worksheet
wb = xlrd.open_workbook("Excel-sheet location here")
sh = wb.sheet_by_index(0)
#Iterate through each row in worksheet and fetch values into dict
data_list = []
for rownum in range(1, sh.nrows):
data = OrderedDict()
row_values = sh.row_values(rownum)
data['<Column Name1>'] = row_values[0]
data['<Column Name2>'] = row_values[1]
data_list.append(data)
#Write to file:
with open("RulesJson.json", "w", encoding="utf-8") as writeJsonfile:
json.dump(data_list, writeJsonfile, indent=4,default=str)