data manipulation

K

Krishna

I have a script that reads an excel file and and do manipulations on
it. But, now, I have a text file that needs the same manipulation. I
tried the same script, but it will not work, when I use command such
as: workbook = xlrd.open_workbook('C:/trial.txt'), its giving me
errors saying "expected BOF record". I was wondering how to work
around this. Do I have to do some format conversion to accomplish this
or am I missing something

Thanks
Krishna
 
J

Jeff

The function expects an excel file. It cannot read a plain text
file. You would need to figure out a way to convert the text file
data into an excel format and save it to a new file first.

The proper way to handle this is to make your data processing
functions expect a defined format. Then, you write importer functions
for various types of files that convert the data in each file to the
defined format. That way, you can support various file formats and
reuse your processing functions on all of them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,084
Latest member
HansGeorgi

Latest Threads

Top