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
18
votes
1 answer

Python XLWT adjusting column widths

I am enormously impressed with the ease of use of XLWT, but there is one thing I have not figured out how to do. I am trying to adjust certain rows to the minimum width they would need to display all characters (in other words, what excel would do…
TimothyAWiseman
  • 14,385
  • 12
  • 40
  • 47
17
votes
1 answer

Python xlwt create faulty excel book

I am trying to use xlwt to create a output file (in .xlsx format) with multiple tabs. The version number of my Python is 2.7, and I am using Aptana Studio 3 as IDE. I've used the xlwt package before, with the same environment, to carry out the same…
ChangeMyName
  • 7,018
  • 14
  • 56
  • 93
17
votes
2 answers

Writing xlwt dates with Excel 'date' format

I'm using xlwt to make a .xls spreadsheet, and I need to create date cells. I've got writing out numbers, and setting the number format string to make them look like dates, but critically they aren't actually getting written as dates - if you do…
xorsyst
  • 7,897
  • 5
  • 39
  • 58
15
votes
2 answers

Setting Cell Formats with xlwt format strings

I've looked around for several different xlwt formats for cells, but I can't find a comprehensive list. Excel provides the following options for cell content formatting: (general, number, currency, accounting, date, time, percentage, fraction,…
user2569332
  • 555
  • 1
  • 4
  • 12
15
votes
3 answers

xlwt write excel sheet on the fly

I am used to creating a spreadsheet in the following way: wbk = xlwt.Workbook() earnings_tab = wbk.add_sheet('EARNINGS') wbk.save(filepath) Is there any way to not save to file to a filepath, and instead write it on-the-fly to a user…
David542
  • 104,438
  • 178
  • 489
  • 842
15
votes
4 answers

How to change background color of excel cell with python xlwt library?

I use xlwt Python library to write data in excel workbook. And now I have some problems with adding background color to excel cell. For example I have next color in RGB(10,20,30), what is the easiest way to do this? Is there any way to set this…
Ishikawa Yoshi
  • 1,779
  • 8
  • 22
  • 43
14
votes
6 answers

Calculating Excel sheets without opening them (openpyxl or xlwt)

I made a script that opens a .xls file, writes a few new values in it, then saves the file. Later, the script opens it again, and wants to find the answers in some cells which contain formulas. If I call that cell with openpyxl, I get the formula…
Frtschaal
  • 75
  • 1
  • 1
  • 9
12
votes
3 answers

xlwt set style making error: More than 4094 XFs (styles)

I use Xlwt for writing an excel file. it's cells has some style (color, alignment ,borders , ... ) when i use XFStyle and set borders and other attr of style, in some cases it make error: More than 4094 XFs (styles) why? what should i do with this…
happy Sun
  • 579
  • 8
  • 15
11
votes
3 answers

xlwt limiting the number of rows

I got the error below when I run the python tool to create an xls file by reading an xml file. How do I fix it? ValueError: row index (65536) not an int in range(65536) File "D:\Zipfiles\Script_try.py", line 82, in _execute_test self.parser =…
user2190483
  • 269
  • 1
  • 5
  • 22
10
votes
3 answers

Save Pandas DataFrames with formulas to xlsx files

In a Pandas DataFrame i have some "cells" with values and some that need to contain excel formulas. I have read that i can get formulas with link = 'HYPERLINK("#Groups!A' + str(someInt) + '"; "LINKTEXT")' xlwt.Formula(link) and store them in the…
Samuel Blickle
  • 368
  • 1
  • 2
  • 16
10
votes
3 answers

how to do excel's 'format as table' in python

I'm using xlwt to create tables in excel. In excel there is a feature format as table which makes the table have an automatic filters for each column. Is there a way to do it using python?
orenma
  • 1,163
  • 2
  • 10
  • 19
10
votes
1 answer

AttributeError: 'Sheet' object has no attribute 'write'

I am trying to write a string in a cell within an excel file. My code is import xlwt import xlrd workbook = xlrd.open_workbook('my_workbook.xls') worksheet = workbook.sheet_by_index(0) worksheet.write(0,2,"string") While I was looking for a…
Peter Lazarov
  • 281
  • 2
  • 3
  • 12
9
votes
2 answers

Freeze cells in excel using xlwt

I am creating worksheets on a fly and not naming them anything. I am unable to freeze the first column and row. I tired working with naming the sheet when adding it to the workbook and it works. However doesn't work on the fly. Below is the…
Raghav Shaligram
  • 309
  • 4
  • 11
9
votes
2 answers

text alignment in xlwt with easyxf

I am using xlwt, excel sheet generation module for python. Basically I am trying to use some styles for the text. The coloring part works fine .i.e. import xlwt workbook = xlwt.Workbook(encoding='ascii') worksheet = workbook.add_sheet('Test…
beebek
  • 1,893
  • 5
  • 29
  • 33
9
votes
4 answers

How to change fontsize in excel using python

I have to create a content with font as Times New Roman and font size as 16.How to create using python script ? My sample script import xlwt workbook = xlwt.Workbook(encoding = 'ascii') worksheet = workbook.add_sheet('My Worksheet') font =…
gmanikandan
  • 475
  • 3
  • 10
  • 16
1
2
3
42 43