以下所有内容翻译至: https://xlsxwriter.readthedocs.io/

#-------------------------------------------------------------------------------------------------------------------------------

XlsxWriter 是一个用来创建Excel XLSX 文件的Python 模块。

demo:

demo 代码:

###################################################################################

##############################################################################
#
# A simple example of some of the features of the XlsxWriter Python module.
#
# Copyright 2013-2018, John McNamara, jmcnamara@cpan.org
#
import xlsxwriter #导入xlsxwriter模块 # Create an new Excel file and add a worksheet. #创建一个新的工作簿和工作表
workbook = xlsxwriter.Workbook('demo.xlsx')
worksheet = workbook.add_worksheet() # Widen the first column to make the text clearer. #设置第一列的宽度
worksheet.set_column('A:A', 20) # Add a bold format to use to highlight cells. #定义加粗的格式
bold = workbook.add_format({'bold': True}) # Write some simple text. #用‘A1’等表达方式在单元格中写入简单的文本
worksheet.write('A1', 'Hello') # Text with formatting. #在单元格中写入文本的同时设置格式
worksheet.write('A2', 'World', bold) # Write some numbers, with row/column notation. #用行列号的表达方式(从00开始)在单元格写入数值
worksheet.write(2, 0, 123)
worksheet.write(3, 0, 123.456) # Insert an image. #在单元格中插入图片
worksheet.insert_image('B5', 'logo.png') workbook.close() #关闭工作簿,只有关闭工作簿,文档才会最终显示;

#################################################################################################################

XlsxWriter

XlsxWriter 是一个Python模块,用这个模块可以实现在2007以上版本的exel格式为xlsx的文件中添加多个工作表并且可以插入文本,数字,公式,超链接等。它支持例如格式等很多功能,包含如下:

100% 和excel xlsx 文件兼容;

  支持所有格式;

  支持合并单元格;

  定义名字;

  图表;

  筛选;

  数据验证和下拉列表;

  条件格式;

  工作表插入PNG/JPEG/GMP/WMF/WMF 图片;

  富文本格式字符串;

  单元格注释;

  文本框组件;

  联合Pndas模块;

  写入大文件时支持记忆优化模式;

它支持Python 2.5,2.6,2.7,3.1,3.2,3.3,3.4,3.5,3.6等版本,Jython和PyPy 只使用标准库。

这个文件解释了怎么使用xlsxwrite 模块,阅读下面的章节来了解更多内容,或者直接跳到 Introduction。

  • Content
  • Introduction
  • Getting Started with XlsxWriter
  • ---------------------------------------------------------------------------------
  • Tutorial 1: Create a simple XLSX file
  • Tutorial 2: Adding formatting to the XLSX file
  • Tutorial 3:Writting different types of data to the XLSX file
  • --------------------------------------------------------------------------------
  • The Workbook Class
  • The Worksheet Class
  • The Worbook Class(Page Setup)
  • The Format Class
  • The Chart Class
  • The Chartsheet Class
  • The Exceptions Class
  • ------------------------------------------------------------------------------
  • Working with Cell Notation
  • Working with Formulas
  • Working with Dates and Times
  • Working with Colors
  • Working with Charts
  • Working with Autofilters
  • Working with Data Validation
  • Working with Conditional Formatting
  • Working with Worksheet Tables
  • Working with Textboxes
  • Working with Sparklines
  • Working with Cell Comments
  • Working with Outlines and Grouping
  • Working with Memory and Performance
  • Working with VBA Macros
  • Working with Python Pandas and XlsxWriter
  • ----------------------------------------------------------------------------------
  • Examples
  • ----------------------------------------------------------------------------------
  • Chart Examples
  • ----------------------------------------------------------------------------------
  • Pandas with XlsxWriter Examples
  • ----------------------------------------------------------------------------------
  • Alternative modules for handing Excel files
  • Libraries that use or enhance XlsxWriter
  • Known Issues and Bugs
  • Reporting Bugs
  • Frequently Asked Questions
  • Changes in XlsxWriter
  • Author
  • License

  

Creating Excel files with Python and XlsxWriter(通过 Python和XlsxWriter来创建Excel文件(xlsx格式))的更多相关文章

  1. Working with Excel Files in Python

    Working with Excel Files in Python from: http://www.python-excel.org/ This site contains pointers to ...

  2. Creating Excel files with Python and XlsxWriter——Introduction

    XlsxWriter 是用来写Excel2007版本以上的xlsx文件的Python模块. XlsxWriter 在供选择的可以写Excel的Python模块中有自己的优缺点. #---------- ...

  3. How to export Excel files in a Python/Django application

    https://assist-software.net/blog/how-export-excel-files-python-django-application CONTENTS Introduct ...

  4. python xlsxwriter创建excel 之('Exception caught in workbook destructor. Explicit close() may be required for workbook.',)

    python2.7使用xlsxwriter创建excel ,不关闭xlsxwriter对象,会报错: Exception Exception: Exception('Exception caught ...

  5. Unity3D研究院之在MAC上脚本XlsxWriter写入Excel .xlsx格式

    原地址:http://www.xuanyusong.com/archives/3011 以前找了很久可以跨平台支持读写Excel的工具,我也试了很多种DLL.可在Windows上各个完美支持,可是在M ...

  6. python读、写、修改、追写excel文件

    三个工具包 python操作excel的三个工具包如下 xlrd: 对excel进行读相关操作 xlwt: 对excel进行写相关操作 xlutils: 对excel读写操作的整合 注意,只能操作.x ...

  7. 1、关于python第三方工具操作xls和xlsx格式的excel文档选型的吐血经历

    首先,最近看了python的一本书,其中第7章是关于文章操作的,就计划把python操作excel,word,txt,xml,html,json等格式的文档做个总结,并实现一些功能,但是,第一步就要把 ...

  8. 用 python 来操作 docx, xlsx 格式文件(一)(使用 xlsxwriter 库操作xlsx格式文件)

    需要从数据库读取日志生成相应的 docx,xlsx 文件做相应的记录 所以自然要用到docx, xlsxwriter 库 但是这些库的应用场景非常广泛,任何需要对 word,excel 文件执行重复性 ...

  9. python模块介绍- xlwt 创建xls文件(excel)

    python模块介绍- xlwt 创建xls文件(excel) 2013-06-24磁针石 #承接软件自动化实施与培训等gtalk:ouyangchongwu#gmail.comqq 37391319 ...

随机推荐

  1. pytest自动化6:pytest.mark.parametrize装饰器--测试用例参数化

    前言:pytest.mark.parametrize装饰器可以实现测试用例参数化. parametrizing 1.  下面是一个简单是实例,检查一定的输入和期望输出测试功能的典型例子 2.  标记单 ...

  2. vim 匹配查找指定位置的数字,并将数字做运算后赋值

    举例,以下文本中有个DSC开头的以数字命名的jpg文件,我想修改文件名为在原来的基础上加上32,比如第一行中的字符改为:DSC00099.JPG 在vim中输入: :%s/DSC[]\+\(\d\+\ ...

  3. IDEAL 热更新

    <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring- ...

  4. 北大poj- 1009

    Edge Detection Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 22835   Accepted: 5398 D ...

  5. linux 入门学习

    一.命令 1.命令提示符 [root@localhost ~]# [] :提示符的分隔符,无特殊含义: root:当前的登录用户: @:分隔符,无特殊含义: localhost:当前主机名(完整名称: ...

  6. c++ 第二章知识梳理

    2.1.c++语言概括 2.1.1)c++的产生 一个更好的c,由c演变而来 2.1.2)c++的特点 一是尽量兼容c,二是支持面向对象的方法.更安全,且简洁高效. 2.1.3~2.1.5 多数和C相 ...

  7. session的部分理解

    定义 Session:在计算机中,尤其是在网络应用中,称为“会话控制”.Session 对象存储特定用户会话所需的属性及配置信息.这样,当用户在应用程序的 Web 页之间跳转时,存储在 Session ...

  8. 使用Selenium进行浏览器自动化操作记录

    一位经验丰富的同事交给了我一个任务:将20个IP地址添加到公司系统对应的目录下. 这个任务之前做过,并且数量是远不止20个,当时就学习Selenium并且使用Python3.6写了一个脚本用来自动化地 ...

  9. eclipse 中git无法https下载提交代码

    使用eclipse下载github代码时,报错信息为cannot open git-upload-pack,如下图: 其实就是ssl协议的版本不对, 2018年2月8日后禁止通过TLSv1.1协议连接 ...

  10. redux源码图解:createStore 和 applyMiddleware

    在研究 redux-saga时,发现自己对 redux middleware 不是太了解,因此,便决定先深入解读一下 redux 源码.跟大多数人一样,发现 redux源码 真的很精简,目录结构如下: ...