Django – Excel上传数据 (Openpyxl)
view def depart_multi(request): from openpyxl import load_workbook # 1.获取文件对象 file_object = request.FILES.get("exc") print(file_object) print(type(file_object)) # 2.对象传递给openpyxl, 并由openpyxl读取其中内容 wb = load_workbook(file_object) sheet = wb.worksheets[0] # 3. 循环获取数据 for r...