Library to create spreadsheet files compatible with MS Excel 97/2000/XP/2003 XLS files, on any platform.

Overview

Travis Coveralls Docs PyPI

xlwt

This is a library for developers to use to generate spreadsheet files compatible with Microsoft Excel versions 95 to 2003.

The package itself is pure Python with no dependencies on modules or packages outside the standard Python distribution.

Please read this before using this package: https://groups.google.com/d/msg/python-excel/P6TjJgFVjMI/g8d0eWxTBQAJ

Installation

Do the following in your virtualenv:

pip install xlwt

Quick start

import xlwt
from datetime import datetime

style0 = xlwt.easyxf('font: name Times New Roman, color-index red, bold on',
    num_format_str='#,##0.00')
style1 = xlwt.easyxf(num_format_str='D-MMM-YY')

wb = xlwt.Workbook()
ws = wb.add_sheet('A Test Sheet')

ws.write(0, 0, 1234.56, style0)
ws.write(1, 0, datetime.now(), style1)
ws.write(2, 0, 1)
ws.write(2, 1, 1)
ws.write(2, 2, xlwt.Formula("A3+B3"))

wb.save('example.xls')

Documentation

Documentation can be found in the docs directory of the xlwt package. If these aren't sufficient, please consult the code in the examples directory and the source code itself.

The latest documentation can also be found at: https://xlwt.readthedocs.io/en/latest/

Problems?

Try the following in this order:

Acknowledgements

xlwt is a fork of the pyExcelerator package, which was developed by Roman V. Kiseliov. This product includes software developed by Roman V. Kiseliov <[email protected]>.

xlwt uses ANTLR v 2.7.7 to generate its formula compiler.

Comments
  • Use more modern utf-8 encoding for source files

    Use more modern utf-8 encoding for source files

    Avoids errors like these when processing Django messages with xgettext:

    xgettext: ./env/lib/python2.7/site-packages/xlwt/Bitmap.py:1: Unknown encoding "windows-1251". Proceeding with ASCII instead.
    xgettext: ./env/lib/python2.7/site-packages/xlwt/Cell.py:1: Unknown encoding "windows-1252". Proceeding with ASCII instead.
    xgettext: ./env/lib/python2.7/site-packages/xlwt/Column.py:1: Unknown encoding "windows-1252". Proceeding with ASCII instead.
    xgettext: ./env/lib/python2.7/site-packages/xlwt/CompoundDoc.py:1: Unknown encoding "windows-1252". Proceeding with ASCII instead.
    xgettext: Non-ASCII string at ./env/lib/python2.7/site-packages/xlwt/CompoundDoc.py:209.
              Please specify the source encoding through --from-code.
    
    opened by federicobond 23
  • Python 3 support

    Python 3 support

    Following discussion on PR #32, this adds Python 3 support without any external dependencies. Python 2.6 and above and Python 3.3 and above should work; older versions will not.

    The tests are passing on Python 2 and 3; I haven't tried the examples.

    opened by takluyver 21
  • Py3.3 support for xlwt

    Py3.3 support for xlwt

    Hi John,

    I have patched xlwt to support Python 3.3 as well as Python 2.6/2.7 with a single codebase (i.e. no embedded 2to3 conversion).

    This currently introduces one dependency: my future package for Py2/3 compatibility.

    I would be interested in your feedback. The patch set is big but most of the changes should be uncontroversial (e.g. converting print statements to print functions). The unicode / bytes disambiguation was the most difficult part.

    It seems to work now under both Python 3.3 and Python 2.7 for all the example scripts, but this could do with more testing.

    Kind regards, Ed Schofield ([email protected])

    opened by edschofield 20
  • Include license file in distributions

    Include license file in distributions

    Include license file in source distribution by using MANIFEST.in.

    Include license file in the generated wheel package. The wheel package format supports including the license file. This is done using the [metadata] section in the setup.cfg file. For additional information on this feature, see:

    https://wheel.readthedocs.io/en/stable/index.html#including-the-license-in-the-generated-wheel-file

    opened by jdufresne 9
  • Add ability to insert bitmap images from in-memory copies.

    Add ability to insert bitmap images from in-memory copies.

    This patch adds a new 'insert_bitmap_data' function on the Worksheet to complement the 'insert_bitmap' function. As the existing 'insert_bitmap' function depends on a filename as one if it's arguments, the new function allows programs that have a copy of the bitmap in memory to add it to the worksheet without first having to write it to file.

    opened by rossigee 9
  • Tests from xlwt3

    Tests from xlwt3

    Adds tests from Manfred Moitzi's xlwt3 port, and gets them passing with xlwt on Python 2.

    Don't merge this until Manfred has agreed to relicense the tests, as they currently say GPL3 at the top of each file. He agreed to do this for the xlrd tests, and I've emailed him about it, so I'm optimistic that he'll OK that soon.

    opened by takluyver 5
  • Start of a test suite

    Start of a test suite

    I put together some tests to aid in porting to Python 3. Hopefully they're a good starting point. Feedback from those better acquainted with the code would be appreciated. I attempted to make them so that they'll work in both 2 and 3.

    opened by hlawrenz 4
  • Raise exception in Workbook.save() when saving a workbook with no worksheets

    Raise exception in Workbook.save() when saving a workbook with no worksheets

    I ran into this problem when learning how to use xlwt. Currently it throws an unhelpful index error:

    import xlwt wb=xlwt.Workbook() wb.save("/tmp/test.xls") Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/xlwt/Workbook.py", line 710, in save doc.save(filename_or_stream, self.get_biff_data()) File "/usr/local/lib/python2.7/dist-packages/xlwt/Workbook.py", line 680, in get_biff_data self.__worksheets[self.__active_sheet].selected = True IndexError: list index out of range

    opened by mapellegrini 3
  • Row.set_height addition

    Row.set_height addition

    I couldn't find a way to set the height of a row to a fixed value independent from the font height in the current version of the API, so I added a small method to the Row class which does that.

    opened by BornToTip 3
  • Allows get sheet or sheet index by sheet name

    Allows get sheet or sheet index by sheet name

    Hi, This pull request is referent to #66, that was closed due lack of feedback. I've made the changes that you requested. Sorry, but I was working in another project.

    opened by fabiofsilva 3
Single API for reading, manipulating and writing data in csv, ods, xls, xlsx and xlsm files

pyexcel - Let you focus on data, instead of file formats Support the project If your company has embedded pyexcel and its components into a revenue ge

null 1.1k Dec 29, 2022
PowerShell module to import/export Excel spreadsheets, without Excel

PowerShell + Excel = Better Together Automate Excel via PowerShell without having Excel installed. Runs on Windows, Linux and MAC. Creating Tables, Pi

Doug Finke 2k Dec 30, 2022
Excel-report-evaluator - A simple Python GUI application to aid with bulk evaluation of Microsoft Excel reports.

Excel Report Evaluator Simple Python GUI with Tkinter for evaluating Microsoft Excel reports (.xlsx-Files). Usage Start main.py and choose one of the

Alexander H. 1 Dec 29, 2021
Python Module for Tabular Datasets in XLS, CSV, JSON, YAML, &c.

Tablib: format-agnostic tabular dataset library _____ ______ ___________ ______ __ /_______ ____ /_ ___ /___(_)___ /_ _ __/_ __ `/__ _

Jazzband 4.2k Dec 30, 2022
A Python module for creating Excel XLSX files.

XlsxWriter XlsxWriter is a Python module for writing files in the Excel 2007+ XLSX file format. XlsxWriter can be used to write text, numbers, formula

John McNamara 3.1k Dec 29, 2022
Xiaobo Zhang 30 Jan 8, 2023
ExcelPeek is a tool designed to help investigate potentially malicious Microsoft Excel files.

ExcelPeek is a tool designed to help investigate potentially malicious Microsoft Excel files.

James Slaughter 37 Apr 16, 2022
PyExcelerate - Accelerated Excel XLSX Writing Library for Python 2/3

PyExcelerate Accelerated Excel XLSX writing library for Python master: dev: test coverage: Authors: Kevin Wang and Kevin Zhang Copyright 2015 Kevin Wa

null 448 Dec 28, 2022
Reads Data from given Excel File and exports Single PDFs and a complete PDF grouped by Gateway

E-Shelter Excel2QR Reads Data from given Excel File and exports Single PDFs and a complete PDF grouped by Gateway Features Reads Excel 2021 Export Sin

Stefan Knaak 1 Nov 13, 2021
Transpiler for Excel formula like language to Python. Support script and module mode

Transpiler for Excel formula like language to Python. Support script and module mode (formulas are functions).

Edward Villegas-Pulgarin 1 Dec 7, 2021
Upload an Excel/CSV file ( < 200 MB) and produce a short summary of the data.

Data-Analysis-Report Deployed App 1. What is this app? Upload an excel/csv file and produce a summary report of the data. 2. Where to upload? How to p

Easwaran T H 0 Feb 26, 2022
According to the received excel file (.xlsx,.xlsm,.xltx,.xltm), it converts to word format with a given table structure and formatting

According to the received excel file (.xlsx,.xlsm,.xltx,.xltm), it converts to word format with a given table structure and formatting

Diakonov Andrey 2 Feb 18, 2022
Universal Office Converter - Convert between any document format supported by LibreOffice/OpenOffice.

Automated conversion and styling using LibreOffice Universal Office Converter (unoconv) is a command line tool to convert any document format that Lib

null 2.4k Jan 3, 2023
Create Open XML PowerPoint documents in Python

python-pptx is a Python library for creating and updating PowerPoint (.pptx) files. A typical use would be generating a customized PowerPoint presenta

Steve Canny 1.7k Jan 5, 2023
A flask extension using pyexcel to read, manipulate and write data in different excel formats: csv, ods, xls, xlsx and xlsm.

Flask-Excel - Let you focus on data, instead of file formats Support the project If your company has embedded pyexcel and its components into a revenu

null 247 Dec 27, 2022
Fully Automated YouTube Channel ▶️with Added Extra Features.

Fully Automated Youtube Channel ▒█▀▀█ █▀▀█ ▀▀█▀▀ ▀▀█▀▀ █░░█ █▀▀▄ █▀▀ █▀▀█ ▒█▀▀▄ █░░█ ░░█░░ ░▒█░░ █░░█ █▀▀▄ █▀▀ █▄▄▀ ▒█▄▄█ ▀▀▀▀ ░░▀░░ ░▒█░░ ░▀▀▀ ▀▀▀░

sam-sepiol 249 Jan 2, 2023
Use Google's BERT for named entity recognition (CoNLL-2003 as the dataset).

For better performance, you can try NLPGNN, see NLPGNN for more details. BERT-NER Version 2 Use Google's BERT for named entity recognition (CoNLL-2003

Kaiyinzhou 1.2k Dec 26, 2022
xlwings is a BSD-licensed Python library that makes it easy to call Python from Excel and vice versa. It works with Microsoft Excel on Windows and macOS. Sign up for the newsletter or follow us on twitter via

xlwings - Make Excel fly with Python! xlwings CE xlwings CE is a BSD-licensed Python library that makes it easy to call Python from Excel and vice ver

xlwings 2.5k Jan 6, 2023
Single API for reading, manipulating and writing data in csv, ods, xls, xlsx and xlsm files

pyexcel - Let you focus on data, instead of file formats Support the project If your company has embedded pyexcel and its components into a revenue ge

null 1.1k Dec 29, 2022