Business

2020年4月30日

Python 處理Excel 表格

一、xlrd

作用:方便讀取多頁工作表的 XLS 檔。

安裝:

 pip install xlrd

處理Excel表格

import xlrd
#讀取 excel檔
xls_file= xlrd.open_workbook('demo.xlsx')
sheets = book.sheets()   

#列出每一個工作表,並且印出工作表的名字
for sheet in sheets: 
    print(sheet.name)