python-excelを読み込みdjangoフレームワークを介してmysql(完全コード)に入庫
1502 ワード
import xlrd , uuid
class JenkinsImport(View):
def get(self,request):
xls = xlrd.open_workbook('./test.xls')
sheets = xls.sheet_names() # sheet,
table = xls.sheets()[1]
rows = table.nrows
for line in range(1, rows):
item = table.row_values(line)
print(item)
text = item[1] # excel
snippet = Categroy.objects.create(
text = text if text else None,
cate_uuid=uuid.uuid4(),
)return JsonResponse({})