Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python3 xlutils.copy_Python_Excel - Fatal编程技术网

Python3 xlutils.copy

Python3 xlutils.copy,python,excel,Python,Excel,我使用xlutils.copy()复制我使用xlrd打开的excel文件。 然后我处理excel文件,获取相关数据并使用xlwr.write()为复制的excel文件中使用的行添加注释。 最后一步是使用xlwr.save()保存复制的excel文件。 到目前为止,一切顺利。代码的本质部分如下所示 import xlwt import xlrd from xlutils.copy import copy rb = xlrd.open_workbook(file) # print

我使用
xlutils.copy()
复制我使用
xlrd
打开的excel文件。 然后我处理excel文件,获取相关数据并使用
xlwr.write()
为复制的excel文件中使用的行添加注释。 最后一步是使用
xlwr.save()
保存复制的excel文件。 到目前为止,一切顺利。代码的本质部分如下所示

import xlwt
import xlrd
from xlutils.copy import copy

    rb = xlrd.open_workbook(file)
    # print (rb)
    wb = copy(rb)
    # print (wb)
    sheet = rb.sheet_by_name(MNS Brandmelders')
    wsheet = wb.get_sheet(0)

    os.remove(file)
    os.chdir(path_opslag)
    # wb.save(file)
    os.chdir(path)
    continue
在上面的示例中,wb.save命令已被禁用。 我在运行Windows7和Python3.5.1的笔记本电脑上编写了脚本。 但是,如果我将文件复制到生产环境中,它会在最后一个save命令中报告错误。在Windows7上也可以使用python 3.5.1进行生产


AttributeError:“dict\u items”对象没有属性“sort”

您知道
按名称工作表参数中缺少
吗?我也面临同样的问题。您知道
按名称工作表参数中缺少
吗?我也面临同样的问题。