from openpyxl import load_workbook '' ' @File : @Author : william @Time : 2020/09/29 @notice : null @coding : utf-8 ' '' # import xlrd # from xlutils.copy import copy import openpyxl # 다음 교육 프로그램이 인식 엑셀 엑셀 통합 문서 파일 이름에 맞게 #을하고 ws_qiyeshu = 0 qiyeshu_row = 0 qiyeshu_column = 0 ws_zichanzongji = 0 zichanzongji_row = 0 zichanzongji_column = 0 ws_zichanzongjizengsu = 0 zichanzongjizengsu_row = 0 zichanzongjizengsu_column = 0 ws_zichanzongji = 0 zichanzongji_row = 0 zichanofficer_column = 0 ############################################ #### ############## 대차 대조표 및 통합 문서 잠금 # 다음 코드는 여러 관련 테이블을 여는 데 사용됩니다. fn = 'Balance Sheet.xlsx'wb = openpyxl .load_workbook (fn) allSheets = wb. get_sheet_names () for i in range (len (allSheets)) : sheet = wb.get_sheet_by_name (allSheets [i]) for row in sheet.iter_rows () : for cell in row : if str (str (cell.value) .replace ( '', '')). find ( "대차 대조표")! = -1 : sheet_selected = wb.get_sheet_by_name (allSheets [i]) break ws = wb.get_sheet_by_name (sheet_selected .title) print (ws) ### ######## ws.iter_rows ()의 행에 대한 지난시 재무 분기 보고서보고 단위 번호 : 행의 셀 : if str (str (cell.value) .replace ( '', '')). find ( "总计")! = -1 : qiyeshu_row = cell.row else : ws_qiyeshu = 0 ws.iter_rows ()의 행 중단 : 행의 셀 : if str (str (cell.value) .replace ( '', '')). find ( "企业 数")! = -1 : qiyeshu_column = cell.column break if qiyeshu_row == 0 또는 qiyeshu_column == 0 : ws_qiyeshu = 0 else : if ws.cell (row = qiyeshu_row, column = qiyeshu_column) .value! = None : ws_qiyeshu = ws.cell (row = qiyeshu_row, column = qiyeshu_column) .value print (ws_qiyeshu) # ################# 全市 限额 以上 企业 资产 总计 ws.iter_rows ()의 행 : 행의 셀 : if str (str (cell.value) .replace ( '', '')). find ( "总计")! = -1 : zichanzongji_row = cell.row else : ws_zichanzongji = 0 ws.iter_rows ()의 행 중단 : 행의 셀 : if str (str (cell.value) .replace ( '', '')). find ( "资产 总计")! =- 1 : zichanzongji_column = cell.column break if zichanzongji_row == 0 또는 zichanzongji_column == 0 : ws_zichanzongji = 0 else : if ws.cell (row = zichanzongji_row, column = zichanzongji_column) .value! = 없음 : ws_zichanzongji = ws.cell (row = zichanzongji_row, column = zichanzongji_column) .value print (ws_zichanzongjizongji_column) ##################### ws.iter_rows ()의 행 : 행의 셀 : if str (str (cell.value) .replace ( ' ',' ')). find ( "总计")! = -1 : zichanzongjizengsu_row = cell.row else : ws_zichanzongjizengsu = 0 ws.iter_rows ()의 행 중단 : 행의 셀 : if str (str (cell. value) .replace ( '', '')). find ( "资产 总计")! = -1 : zichanzongjizengsu_column = cell.column + 2 break else : if ws.cell (row = zichanzongjizengsu_row, column = zichanzongjizengsu_column ) .value! = 없음 : zichanzongjizengsu_row == 0 또는 zichanzongjizengsu_column == 0 인 경우 : ws_zichanzongjizengsu = 0 ws_zichanzongjizengsu = ws.cell (row = zichanzongjizengsu_row, column = zichanzongjizengsu_column) .value print (ws_zichanzongjizengsu) ########## 怚 议 ##### 批发 에서 .iter_rows () : 행의 셀 : if str (str (cell.value) .replace ( '', '')). find ( "一 、 批发 业")! = -1 : pifazichanzongji_row = cell.row else : ws_pifazichanzongji = 0 ws.iter_rows ()의 행 중단 : 행의 셀 : if str (str (cell.value) .replace ( '', '')). find ( "资产 总计")! = -1 : pifazichanzongji_column = cell.column 나누기 if pifazichanzongji_row == 0 또는 pifazichanzongji_column == 0 : ws_pifazichanzongji = 0 else : if ws.cell (row = pifazichanzongji_row, column = pifazichanzongji_column) .value! = None : ws_pifazichanzongjichanzongji = ws_pifazichanzongji = ws_pifazichanzongji_column value print (ws_pifazichanzongji) ######################## for row in ws.iter_rows () : for cell in row : if str (str (cell .value) .replace ( '', '')). find ( "一 、 批发 业")! = -1 : pifazichanzongjizs_row = cell.row else : ws_pifazichanzongjizs = ws.iter_rows ()의 행에서 0 나누기 : 셀 행: if str (str (cell.value) .replace ( '', '')). find ( "资产 总计 ")! = -1 : pifazichanzongjizs_column = 셀.열 + 2 나누기 if pifazichanzongjizs_row == 0 또는 pifazichanzongjizs_column == 0 : ws_pifazichanzongjizs = 0 else : if ws.cell (row = pifazichanzongjizs_row, column = pifazichanzongjizs_column) .value! = None : wsfazichanzongjizs value print (ws_pifazichanzongjizs) ###################################### for row in ws.iter_rows () : for cell in row : if str (str (cell.value) .replace ( '', '')). find ( "二 、 零售业")! = -1 : lingshouzichanzongji_row = cell.row else : ws_lingshouzichanzongji = 0 ws.iter_rows ()의 행 중단 : 행의 셀 : if str (str (cell.value) .replace ( '', '')). find ( "资产 总计")! =- 1 : lingshouzichanzongji_column = cell.column의 체류 경우 lingshouzichanzongji_row == 0 lingshouzichanzongji_column == 0 ws_lingshouzichanzongji = 0 다른 : 만약 ws.cell (= lingshouzichanzongji_row 행, 열 = lingshouzichanzongji_column) .value = 없음! ws.iter_rows ()의 행 : 행의 셀 : ws_lingshouzichanzongji = ws.cell (row = lingshouzichanzongji_row, column = lingshouzichanzongji_column) .value print (ws_lingshouzichanzongji) ######################## for row in ws.iter_rows () : for cell in row : if str (str (cell. value) .replace ( '', '')). find ( "二 、 零售业")! = -1 : lingshouzichanzongjizs_row = cell.row else : ws_lingshouzichanzongjizs = 0 break if str (str (cell.value) .replace ( . '', '')) 발견 ( "资产总计") = -1 :! lingshouzichanzongjizs_column = cell.column + 2 휴식 경우 lingshouzichanzongjizs_row == 0 또는 lingshouzichanzongjizs_column == 0 : ws_lingshouzichanzongjizs = 0 다른 : ws.cell (= lingshouzichanzongjizs_row 행, 열 = lingshouzichanzongjizs_column) .value 경우 = 없음! ws_lingshouzichanzongjizs = ws.cell (= lingshouzichanzongjizs_row 행, 열 = lingshouzichanzongjizs_column) .value 인쇄 (ws_lingshouzichanzongjizs) ########### ######################################## for row in ws.iter_rows () : 행의 셀 : if str (str (cell.value) .replace ( '', '')). find ( "3. 숙박업 ")! = -1 : zhusuzichanzongji_row = cell.row else : ws_zhusuzichanzongji = 0 ws.iter_rows ()의 행 중단 : 행의 셀 : if str (str (cell.value) .replace ( '', '')). find ( "资产总计 ")! = -1 : zhusuzichanzongji_column = cell.column 나누기 if zhusuzichanzongji_row == 0 또는 zhusuzichanzongji_column == 0 : ws_zhusuzichanzongji = 0 else : if ws.cell (row = zhusuzichanzongji_row, column = zhusuzichanzongji_column) .value! = 없음 : ws_zhususuzichanzongji_zhusuzinzhusuzichanzongji = ws_zhusuzichanzongji = ws_zhusuzichanzongji = 0 else : value print (ws_zhusuzichanzongji) ######################## for row in ws.iter_rows () : for cell in row : if str (str (cell .value) .replace ( '', '')). find ( "三 、 住宿业")! = -1 : zhusuzichanzongjizs_row = cell.row else : ws_zhusuzichanzongjizs = ws.iter_rows ()의 행에서 0 나누기 : 셀 행: if str (str (cell.value) .replace ( '', '')). find ( "资产 总计")! = -1 : zhusuzichanzongjizs_column = cell.column + 2 break if zhusuzichanzongjizs_row == 0 또는 zhusuzichanzongjizs_column == 0 : ws_zhusuzichanzongjizs = 0 else : if ws.cell (row = zhusuzichanzongjizs_row, column = zhusuzichanzongjizs_column) .value! = 없음 ws_zhusuzichanzongjizs = ws.cell (row = zhusuzichanzongjizs_row, column = zhusuzichanzongjizs_column) .value print (ws_zhusuzichanzongjizs) ############################## ################################################ ## ws.iter_rows ()의 행 : 행의 셀 : if str (str (cell.value) .replace ( '', '')). find ( "四 、 餐饮 业")! = -1 : canyinzichanzongji_row = cell.row 기타 : ws_canyinzichanzongji = 0 ws.iter_rows ()의 행 중단 : 행의 셀 : if str (str (cell.value) .replace ( '', '')). find ( "资产 总计")! = -1 : canyinzichanzongji_column = cell.column 나누기 if canyinzichanzongji_row == 0 또는 canyinzichanzongji_column == 0 : ws_canyinzichanzongji = 0 else : if ws.cell (row = canyinzichanzongji_row, column = canyinzichanzongji_rowji, canyinzongji_column = ws.cellji_column = column = canyinzichanzongji_column) .value print (ws_canyinzichanzongji) ######################## for row in ws.iter_rows () : for cell in row : if str (str (cell.value) .replace ( '', '')). find ( "四 、 餐饮 业")! = -1 : canyinzichanzongjizs_row = cell.row else : ws_canyinzichanzongjizs = ws.iter_rows ()의 행에 대해 0 나누기 : 행의 셀 : if str (str ( cell.value) .replace ( '', '')). find ( "资产 总计")! = -1 : canyinzichanzongjizs_column = cell.column + 2 break if canyinzichanzongjizs_row == 0 또는 canyinziinzichanzongjizs_column = 0 else : ws_canyinzichanzongjizs_column == 0 : if ws.cell (row = canyinzichanzongjizs_row, column = canyinzichanzongjizs_column) .value! = None : ws_canyinzichanzongjizs = ws.cell (row = canyinzichanzongjizs_row, column = canyinzichanzongjizs_column) .value print (ws_canyinzichanofficerzs) ######################################### ### ###########
분기 별 재무 보고서 0.1
추천
출처blog.csdn.net/jidawanghao/article/details/112826206
추천
행