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

How can I set the "default" worksheet with xlwt?

I'm using Python and xlwt to create Excel files: wb = xlwt.Workbook(encoding='utf-8') ws = wb.add_sheet('Sheet1') # ... fill Sheet1 with some data ... ws = wb.add_sheet('Sheet2') # ... fill Sheet2 with some data ... wb.save('test.xls') When I open…
Siim K
  • 209
  • 1
  • 3
  • 10
3
votes
1 answer

python xlwt: how to have header vrow repeat when printing

I'm writing sheets in xlwt with a header row and a few hundred data rows. I'd like the header row to print at the top of every printed page, when I print from Excel. Can I effect this setting from xlwt? Thanks!
Gerry
  • 1,303
  • 1
  • 10
  • 16
3
votes
1 answer

Python XLWT: Write a list into a cell

I am trying to write a list into a cell using Python XLWT. Is this possible? I am currently getting an error: Exception: Unexpected data type The code: for x in result: sheet1.write(row2,0,x[0]) …
Emile
  • 3,464
  • 8
  • 46
  • 77
3
votes
3 answers

Exporting to Excel .xlsx from a Python Pyramid project

I know about the XLWT library, which I've used before on a Django project. XLWT is very neat but as far as I know, it doesn't support .xlsx which is the biggest obstacle in my case. I'm probably going to be dealing with more than 2**16 rows of…
chiurox
  • 1,549
  • 3
  • 18
  • 28
3
votes
1 answer

xlwt: Is it possible to adjust the style of a cell after creating it?

After you do: sheet.write(0, 1, 'whatevs') Is it still possible to adjust the style of cell 0,1. The reason I am asking is that I have a list of errors I loop and I would like to color all the cells red that have an error. I could do it when I…
Pickels
  • 33,902
  • 26
  • 118
  • 178
3
votes
1 answer

Reading background color of a cell of an excel sheet from python?

I am working in python and using xlwt. I have got a sample excel sheet and have to generate same excel sheet from python. Now the problem is heading columns are highlighted using some color from excel color palette and I am not able to find the…
codecool
  • 5,886
  • 4
  • 29
  • 40
3
votes
2 answers

Is it possible to specify Date XFStyle without an exact format with xlwt?

I'm using Python-Excel xlwt to create a blank Excel spreadsheet for filling out in a spreadsheet. I would like to specify that a certain range of cells should be date formatted. I'm doing something like: datestyle =…
Joe
  • 46,419
  • 33
  • 155
  • 245
3
votes
1 answer

write array starting from specific column to new workbook using xlwt

I am trying to write an array (data = [][]) to a worksheet I will create using xlwt. My question is can I specify a column to start from? I am planning to use a for loop to iterate through the array retrieving the values row by row starting a new…
Corey
  • 405
  • 2
  • 9
  • 18
3
votes
2 answers

xlwt.Style.EasyXFCallerError: section 'fill' is unknown

I have a data frame in which I am making updations like writing and adding the background colour to a specific cell. It looks fine in dataframe. But when I convert dataframe to excel, found the below error. df.to_excel("test_sheet.xls") is causing…
Arun Augustine
  • 1,690
  • 1
  • 13
  • 20
3
votes
1 answer

Merging two excel files using python with mismatching sizes

I have been trying to merge those two excel files. Those files are already ready to be joined just as you can see in my image example. I have tried the solutions from the answer here using pandas and xlwt, but I still can not save both in one…
may
  • 1,073
  • 4
  • 14
  • 31
3
votes
2 answers

Writing multi-indexed data to an excel file with Python/Pandas

I want to create an Excel spreadsheet and insert equal number of rows for each of variable. The ideal result shall looked like Columns A & B in the picture. What I can do so far is only to insert for 1 name (Columns D & E), and have no idea do the…
Mark K
  • 8,767
  • 14
  • 58
  • 118
3
votes
2 answers

Python 3 - xlwt save Workbook error

I'm writing a small program in Python 3.6 that reads an excel file and then modifies the format of a cell. I want multiple formats within the same cell so I'm using xlwt with write_rich_text: import xlrd import xlwt from xlutils.copy import…
3
votes
1 answer

Pandas to_excel to write a dataframe results in blank spreadsheet - how write to excel using xlwt?

Writing a dataframe: New_DF = caviae species murliniae freundii braakii freundii cloacae \ 15368485 NaN NaN NaN NaN NaN NaN NaN 15368486 NaN NaN NaN 1 NaN …
G.Peach
  • 59
  • 2
  • 8
3
votes
3 answers

python : Get Active Sheet in xlrd? and help for reading and validating excel file in Python

2 Questions to ask: Ques 1: I just started studying about xlrd for reading excel file in python. I was wondering if there is a method in xlsrd --> similar to get_active_sheet() in openpyxl or any other way to get the Active sheet…
dollardhingra
  • 303
  • 4
  • 14
3
votes
3 answers

Deleting Entire blank row in an existing Excel Sheet using Python

How to remove the entire blank row from the existing Excel Sheet using Python? I need a solution which DOES NOT : Include reading the whole file and rewriting it without the deleted row. IS THERE ANY DIRECT SOLUTION?
Jd16
  • 387
  • 1
  • 3
  • 11