SHARE
TWEET

[미래에셋6기] 엑셀 파싱

jhyoo Jun 25th, 2019 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from openpyxl import load_workbook
  2.  
  3. wb = load_workbook("인사기록.xlsx")
  4. ws = wb.active
  5.  
  6. # 엑셀의 B3부터 데이터가 존재함
  7.  
  8. # A1 (1, 1)  B1 (1, 2) C1 (1, 3)
  9. # A2 (2, 1)  B2 (2, 2) C2 (2, 3)
  10. # A3 (3, 1)  B3 (3, 2) C3 (3, 3)
  11.  
  12. for row in range(3, ws.max_row):
  13.     if ws.cell(row, 2).value is None:        
  14.         break
  15.    
  16.     직급 = ws.cell(row, 2).value
  17.     소속 = ws.cell(row, 3).value
  18.     시작 = ws.cell(row, 4).value
  19.     종료 = ws.cell(row, 5).value
  20.     근무일 = 종료 - 시작
  21.    
  22.     print(직급, 소속, 근무일.days)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top