标签:end 新建 name div from min style sea list
1 #coding:utf8 2 ‘‘‘ 3 Created on 2018年8月18日 4 5 @author: Administrator 6 ‘‘‘ 7 # from openpyxl import load_workbook 8 # 9 # wb=load_workbook("empty_book.xlsx") 10 # 11 # sheet_ranges=wb[‘range names‘] 12 # print(sheet_ranges[‘D18‘].value) 13 14 15 # import openpyxl 16 # 17 # wb=openpyxl.Workbook() 18 # ws=wb.active 19 # ws.column_dimensions.group(‘A‘,‘D‘,hidden=True) 20 # ws.row_dimensions.group(1,10,hidden=True) 21 # wb.save("group.xlsx") 22 import time,re 23 from openpyxl import load_workbook 24 25 from openpyxl import Workbook 26 import threading 27 #新建的文件 28 nwb=Workbook(write_only=True) 29 def add_ws(nws_name):#负责增加工作表,设置名字 30 obj=nwb.create_sheet(nws_name) 31 obj.sheet_properties.tabColor="1072BA" 32 return obj 33 34 #读的数据文件 35 wb = load_workbook(filename=‘demo_s.xlsx‘) 36 ws=wb.active 37 38 f_name="标题" 39 add_ws(f_name) 40 for row in ws.rows: 41 data_list=[] 42 for cell in row: 43 a=cell.value 44 data_list.append(a) 45 sheetName=str(a) 46 if re.search(r‘^包\d{1,2}$‘,sheetName): 47 print(cell.value) 48 new_ws=add_ws(sheetName) 49 f_name=sheetName 50 nwb[f_name].append(data_list) 51 52 53 nwb.save("new11.xlsx")
标签:end 新建 name div from min style sea list
原文地址:https://www.cnblogs.com/Mengchangxin/p/9497702.html