2 回答

TA贡献2003条经验 获得超2个赞
您也可以使用 openpyxl 模块这里是修改后的代码
import base64
import io
import openpyxl
with open('encoded_data.txt','rb') as d:
data=d.read()
print(data)
decrypted=base64.b64decode(data)
print(decrypted)
xls_filelike = io.BytesIO(decoded_data)
workbook = openpyxl.load_workbook(xls_filelike)
sheet_obj = workbook.active
max_col = sheet_obj.max_column
max_row = sheet_obj.max_row
# Will print all the row values
for i in range(1, max_row +1):
for j in range(1, max_col + 1):
cell_obj = sheet_obj.cell(row = i, column = j)
print cell_obj.value,
print ",", "Inorder to seperate the cells using comma for readability
print ""
添加回答
举报