Giter Club home page Giter Club logo

mp-python-mergeexcel's Introduction

mergeExcel

date:2014-12-07

author:chenxi

email:[email protected]

school:njnu

=========================================================

将多个excel工作簿中的工作表合并到一个新的excel文件中

因为论文需要,最近收集了一些数据,数据量说大也不大,500以内,但是真要自己动手一步步复制粘贴也是够复杂的,能够编写程序避免重复劳动是程序员的基本职业素质,所以这短短几十行代码就诞生了。

首先描述一下,最初的excel结构吧。 问卷调查的存在于excel文件的sheet1工作表中,填写的数据自动保存到本文件的sheet2工作表中(例:=Sheet1!E152,表示等于sheet1工作表E152单元格的数据值),同时为避免这样的对应方式被被调查者修改,我将excel的sheet2工作表隐藏了(无形中增加了许多工作量,还好有vba...哈哈),在将所有的sheet2取消隐藏后就接触到了现在需要解决的问题了:如何将多个excel文件sheet2中的第一行合并到一个excel中呢?

思路:

1.打开需要合并的文件

2.读取第一行数据

3.写到新文件中

4.保存新文件

5.在目录中excel遍历结束前,重复1-4步

=========================================================

注意事项:

1.py文件和xls同一目录 在py中控制不读取最后一个文件(把py文件放在最后)

2.不要事先创建new.xls文件,这是pyexcelerator模块的缺点

mp-python-mergeexcel's People

Contributors

cchenxi avatar

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.