因为xls和xlsx两种格式,xlsx是被加密了传统的方式读取修改不了
下面是xls格式读取修改
# -*- coding: utf-8 -*-#
# -------------------------------------------------------------------------------
# Name: test_excel
# Description:
# Author: GLK
# Date: 2021/7/7
# -------------------------------------------------------------------------------
import xlrd
import os
import datetime
from xlutils.filter import process, XLRDReader, XLWTWriter
#修改表内容
def update_sheet(sheet,sheet_copy,style_list):
if sheet.name != '模板':
# 得到这个表单自己写的内容的个数(因为每个人表格行数个数都不同,所以没法定位自己写了几个)
# rows = sheet.nrows - 11
# 得到一个自己写的列表
print(f"表单名:{sheet.name}", end=" ")
print(f"行数:{sheet.nrows}", end=" ")
print(f"列数:{sheet.ncols}", end=" ")
# print(f"自己写的内容个数:{rows}", end=" ")
# 得到一个单元格的索引位置的格式