GithubHelp home page GithubHelp logo

renmu123 / openpyxl-chinese-docs Goto Github PK

View Code? Open in Web Editor NEW
22.0 2.0 1.0 1.5 MB

这是 openpyxl 的中文文档,欢迎大家进行贡献

Home Page: https://openpyxl-chinese-docs.readthedocs.io/zh_CN/latest/

Makefile 8.18% Python 68.40% HTML 16.11% Batchfile 7.31%
docs openpyxl zh-cn

openpyxl-chinese-docs's Introduction

openpyxl-chinese-docs's People

Contributors

renmu123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

niusz

openpyxl-chinese-docs's Issues

请问如何将worksheet对象添加到现有xlsx文档的新sheet中

您好,做了很多research都没有解决这个问题,所来这里求助一下,我从a文件中读取了worksheet对象

sheet_2_workbook = openpyxl.load_workbook(sheet_2_path)
sheet_2 = sheet_2_workbook.worksheets[0]

如题,我想将其添加到现有xlsx文档的新sheet/工作簿中,具体应该怎么操作呢?

我之前有尝试这么做,但是这个方法得到的新文档会丢失原有的一些格式,包括单元格底色和合并单元格

    old_wb = openpyxl.load_workbook(file_list[i])
    old_sheet_name = old_wb.get_sheet_names()[0]
    old_ws = old_wb[old_sheet_name]
    ws2 = combined_wb.create_sheet(sheet_name)
    for row in old_ws.values:
        ws2.append(row)

我很肯定a文件中读取的worksheet对象是包含这些格式的,因为我用下面代码转存的xlsx文档具备上述提到的格式
sheet_2_workbook.save(filename = temp_save_path)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.