Questions tagged [xlwt]

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

xlwt is a Python library for modifying and generating spreadsheet files that are compatible with Excel 97/2000/XP/2003, OpenOffice.org Calc, and Gnumeric.

xlwt does not (yet) support Excel 2007 (.xlsx, .xlsm) writing.

xlwt has full support for Unicode. Excel spreadsheets can be generated on any platform without needing Excel or a COM server. The only requirement is Python 2.3 or higher. xlwt is a fork of pyExcelerator.

http://pypi.python.org/pypi/xlwt

640 questions
6
votes
6 answers

Python to delete a row in excel spreadsheet

I have a really large excel file and i need to delete about 20,000 rows, contingent on meeting a simple condition and excel won't let me delete such a complex range when using a filter. The condition is: If the first column contains the value, X,…
Jane
  • 63
  • 1
  • 1
  • 3
6
votes
1 answer

Multi select option for a cell in excel using python

I want to create an excel, which should have cell with multi-select dropdown. e.g. if a cell is given options = [a", "b", "c", "d", "e"]. Editor selects "a", then the value in cell should be "a". In the subsequent selection for the same cell, if the…
Somesh
  • 1,235
  • 2
  • 13
  • 29
6
votes
3 answers

How to create an excel file with an autofilter in the first row with xlwt?

I am using Python 2.6 + xlwt module to generate excel files. Is it possible to include an autofilter in the first row with xlwt or pyExcelerator or anything else besides COM? Thanks
jbochi
  • 28,816
  • 16
  • 73
  • 90
6
votes
1 answer

export excel with python using xlwt and adjusting width

i have exported my list using xlwt : response = HttpResponse(mimetype="application/ms-excel") response['Content-Disposition'] = 'attachment; filename=Countries.xls' wb = xlwt.Workbook() ws1 = wb.add_sheet('Countries') ws1.write(0, 0, 'Country…
Drwhite
  • 1,545
  • 4
  • 21
  • 44
6
votes
2 answers

Conditional Formatting xlwt

I have seen some posts that say you can NOT perform conditional formatting using xlwt, but they were rather old. I was curious if this has evolved? I have been searching for about half a day now. Furthermore, if I con't write it directly from xlwt,…
jensencl
  • 117
  • 1
  • 8
6
votes
3 answers

write special characters into excel table by python package pyExcelerator/xlwt

Task: I generate formated excel tables from csv-files by using the python package pyExcelerator (comparable with xlwt). I need to be able to write less-than-or-equal-to (≤) and greater-than-or-equal-to (≥) signs. So far: I can save my table as…
SimonSalman
  • 351
  • 1
  • 6
  • 13
5
votes
1 answer

Preformat to currency and two decimal places in python using xlwt for excel

I have a column heading Fee. Using xlwt in python, I successfully generated the required excel.This column is always blank at the creation of Excel file. Is it possible to have the Fee column preformatted to 'Currency' and 'two decimal places', so…
Abhaya
  • 2,086
  • 16
  • 21
5
votes
1 answer

Python xlwt - making a column readonly (cell protect)

Is there a way to make a particular cell read-only/write protected in python xlwt? I know there's is a cell_overwrite_ok flag which does not allow to overwrite contents of cells (all cells) but can this be done on cell by cell basis. Thanks, Sun
Sunyl
  • 65
  • 2
  • 7
5
votes
3 answers

how to write python array (data = []) to excel?

I am writing a python program to process .hdf files, I would like to output this data to an excel spreadsheet. I put the data into an array as shown below: Code: data = [] for rec in hdfFile[:]: data.append(rec) from here I have created a 2D…
Corey
  • 405
  • 2
  • 9
  • 18
5
votes
1 answer

Serving a dynamically generated MS Excel files using django and xlwt fails in Internet Explorer

I am trying to use xlwt to create MS-Excel files from the contents of the database on my django site. I have seen several solutions here on stackoverflow, in particular this link: django excel xlwt and this django snippet:…
sequoia
  • 3,025
  • 8
  • 33
  • 41
5
votes
1 answer

How to add "existing" worksheet to a workbook using xlrd, xlwt and xlutils

If I understand correctly, a Workbook's add_sheet method creates a new worksheet (and adds it to the workbook). I have an existing excel template (with one formatted sheet that serves as a base to add information to) that I would like to copy using…
chefsmart
  • 6,873
  • 9
  • 42
  • 47
5
votes
2 answers

Numpy.float64 changes when writing to Excel (.xlsx)

I've noticed that when certain Numpy float64 values are saved as Excel file (via a Pandas DataFrame), they get changed. First I thought this has to do with some imprecision in Excel, but Excel seems to encode floating point numbers as double…
orange
  • 7,755
  • 14
  • 75
  • 139
5
votes
1 answer

Adjusting cells width and height in excel in mm/cm through python script

I tried to look for it but couldn't find one. Is there a possibility to adjust the width,height of cells in excel in mm or cm dimensions using openpyxl or xlwt modules? if yes then can someone point me to the commands for scripting? thanks a lot.
5
votes
2 answers

Saving a temporary file

I'm using xlwt in python to create a Excel spreadsheet. You could interchange this for almost anything else that generates a file; it's what I want to do with the file that's important. from xlwt import * w = Workbook() #... do…
Oli
  • 235,628
  • 64
  • 220
  • 299
5
votes
3 answers

xlsxwriter and xlwt: Writing a list of strings to a cell

I am currently using xlwt quite successfully to create .xls files. I am also learning xlsxwriter for possible future applications where I'll need some of its features. xlwt smoothly writes lists of strings into cells. e.g. import xlwt a =…
user4048937