当前位置:首页 > 数据库 > 正文

python--读取excel通过django框架入库mysql(完整代码)

2024-03-31 数据库

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({})

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/SQL/13106.html