xlrd

How do I read an Excel file into Python using xlrd? Can it read newer Office formats?

My issue is below but would be interested comments from anyone with experience with xlrd. I just found xlrd and it looks like the perfect solution but I'm having a little problem getting started. I am attempting to extract data programatically from an Excel file I pulled from Dow Jones with current components of the Dow Jones Industrial...

pyExcelerator or xlrd - How to FIND/SEARCH a row for the given few column data?

Python communicating with EXCEL... i need to find a way so that I can find/search a row for given column datas. Now, i m scanning entire rows one by one... It would be useful, If there is some functions like FIND/SEARCH/REPLACE .... I dont see these features in pyExcelerator or xlrd modules.. I dont want to use win32com modules! it makes...

Unicode to UTF8 for CSV Files - Python via xlrd

I'm trying to translate an Excel spreadsheet to CSV using the Python xlrd and csv modules, but am getting hung up on encoding issues. Xlrd produces output from Excel in Unicode, and the CSV module requires UTF-8. I imaging that this has nothing to do with the xlrd module: everything works fine outputing to stdout or other outputs that d...

create a .csv file with values from a Python list

I am trying to create a .csv file with the values from a Python list when I print the values in the list they are all unicode (?) i.e. they look something like this [u'value 1', u'value 2', ...] if I iterate through the values in the list i.e. for v in mylist: print v they appear to be plain text and I can put a ',' between each with ...

pivots using pyExcelerator/xlrd

How can I go about creating a worksheet (within an excel workbook) with a pivot table using python libs like pyExcelerator / xlrd? I need to generate a daily report that has a pivot table to summarize data on other sheets. One option would be to have a blank template that I copy and populate with the data. In this case, is there a way to...

writing to existing workbook using xlwt

I am unable to find examples where xlwt is used to write into existing files. I have a existing xls file that I need to write to. When I use xlrd to read the file, I cant seem to figure out how to transform the "Book" type returned into a xlwt.Workbook. I would appreciate if someone can point me to an example. ...

Reading numeric Excel data as text using xlrd in Python

Hi guys, I am trying to read in an Excel file using xlrd, and I am wondering if there is a way to ignore the cell formatting used in Excel file, and just import all data as text? Here is the code I am using for far: import xlrd xls_file = 'xltest.xls' xls_workbook = xlrd.open_workbook(xls_file) xls_sheet = xls_workbook.sheet_by_index...

win32com equivalent of xlrd's sheet.ncols

xlrd makes it pretty easy to know what the last column is. is there an easy way using win32com? I have tried using ws.UsedRange.Rows.Count but this doesnt seem to give a correct answer. ...

Why is win32com so much slower than xlrd?

I have the same code, written using win32com and xlrd. xlrd preforms the algorithm in less than a second, while win32com takes minutes. Here is the win32com: def makeDict(ws): """makes dict with key as header name, value as tuple of column begin and column end (inclusive)""" wsHeaders = {} # key is header name, value is column begi...

datetime issue with xlrd & xlwt python libs

I'm trying to write some dates from one excel spreadsheet to another. Currently, I'm getting a representation in excel that isn't quite what I want such as this: "40299.2501157407" I can get the date to print out fine to the console, however it doesn't seem to work right writing to the excel spreadsheet -- the data must be a date type i...

How to locate and access named ranges (global, nd per-worksheet) using xlrd, Python?

The documentation for xlrd here http://www.python-excel.org/ mentions that it is now possible in latest version, but does not say how. ...

Novel tree storage? Django recursive import with XLRD

My data (spreadsheet): '1',,, ,'1.1',, ,,'1.1.1', ,,'1.1.2', ,,'1.1.3', ,'1.2',, ,'1.3',, ,,'1.3.1', ,,'1.3.2', ,,'1.3.3', '2',,, ,'2.1',, ,,'2.1.1', ,,,'2.1.1.1' ,,,'2.1.1.2' ,,,'2.1.1.3' My model: class Vocabulary(models.Model): name = CharField(max_length=60) class Concept(models.Model): parent = ForeignKey('self', blank=...

Question on python xlrd

How to know the total number of columns used in an excel sheet in the following link http://scienceoss.com/read-excel-files-from-python/ Thanks.. ...

Converting a Python Float to a String without losing precision

I am maintaining a Python script that uses xlrd to retrieve values from Excel spreadsheets, and then do various things with them. Some of the cells in the spreadsheet are high-precision numbers, and they must remain as such. When retrieving the values of one of these cells, xlrd gives me a float such as 0.38288746115497402. However, I n...

using xlrd to read Excel xls file containing Chinese and/or Hindi characters

http://scienceoss.com/read-excel-files-from-python/comment-page-1/#comment-1051 From the above link i use this utility to read an xls file.If the xls contains different language characters like chine or hindi.It does not output the exact wordings.Is there a work around for this.. After googling i found this import xlrd def upload_xls...

Django and xlrd, reading from memory

Hello My plan is to let a user to upload an excel file, once uploaded I will be displaying editable form which contains the content of the uploaded excel, once user confirms the input is correct, he/she hits the save button and these items are saved at some model. For this, I have written this view and form: form: IMPORT_FILE_TYPES = ...

Python Excel parsing data with xlrd

Fairly simple; I've got the data I want out of the excel file, but can't seem to find anything inside the XLRD readme that explains how to go from this: xldate:40397.007905092592 number:10000.0 text:u'No' number:0.1203 number:0.096000000000000002 number:0.126 to their respective python datatypes. Any ideas? ...

Preserving styles using python's xlrd,xlwt, and xlutils.copy

Hi Folks, I'm using xlrd, xlutils.copy, and xlwt to open up a template file, copy it, fill it with new values, and save it. However, there doesn't seem to be any easy way to preserve the formatting of the cells; it always gets blown away and set to blank. Is there any simple way I can do this? Thanks! /YGA A sample script: from xlr...

[python] xldate_as_tuple

im not quite sure how to use the following function: xldate_as_tuple for the following data xldate:39274.0 xldate:39839.0 could someone please give me an example on usage of the function for the data? ...

Python xlrd data extraction

I am using python xlrd http://scienceoss.com/read-excel-files-from-python/ to read data from an excel sheet My question is if i read a row with first cell as "Employee name" in the excel sheet And there is another row named whose first cell is "Employee name" How can we read the last column starting with the last row which has "Employ...