column hidden/visible

291 views
Skip to first unread message

Auzzy

unread,
Jun 12, 2010, 11:45:49 PM6/12/10
to python-excel
Hello.
I was wondering if xlrd provides a way to tell if a column is hidden.
Looking at the documentation and source code, it would appear not, but
I'm hoping I've simply missed something. Thanks!

John Machin

unread,
Jun 13, 2010, 1:18:48 AM6/13/10
to python...@googlegroups.com

Colinfo.hidden
Sheet.colinfo_map

Auzzy

unread,
Jun 13, 2010, 10:00:26 AM6/13/10
to python-excel
See, that's the obvious way. I tried it, but of course, it didn't
work. It seems that colinfo_map is not getting populated. I ran this
code:

filePath = "C:/Users/Austin/Desktop"
fileName = "phone numbers (Google).xls"
excelFile = xlrd.open_workbook(filePath + "/" + fileName)
phoneNumSheet = excelFile.sheet_by_name(fileName[:fileName.find(".")])
print phoneNumSheet.colinfo_map

and it shows me that colinfo_map is empty. Any ideas as to why? Is
there something I need to do to populate it?

John Machin

unread,
Jun 13, 2010, 6:38:09 PM6/13/10
to python...@googlegroups.com

Next time, try telling the full story. Otherwise you are wasting your
time and mine.

> Any ideas as to why? Is
> there something I need to do to populate it?
>

Have a look at the source again, specifically the code in sheet.py that
creates Colinfo objects from the COLINFO records in the file -- starts
with the line containing "elif rc == XL_COLINFO:". Don't read much
further than the following line.


Auzzy

unread,
Jun 13, 2010, 9:06:03 PM6/13/10
to python-excel
Thank you John. I cannot tell you just how helpful being rude is. It
just makes your answer that much more valid, not to mention
appreciated! And I also can't tell you how much help it is to tell me
to look at the source code again. Because of course I'm an idiot. It
has nothing to do with the fact that maybe the source code isn't
clear. I'm just stupid and thus missed the answer that was staring me
in the face. And to think I always thought posting a question on one
of these groups was going to attract more assholes than help!
Bit of advice: if someone asks you a question, attacking them is not
going to help anyone, nor make you look good.

Chris Withers

unread,
Jun 14, 2010, 3:53:48 AM6/14/10
to python...@googlegroups.com
Auzzy wrote:
> Bit of advice: if someone asks you a question, attacking them is not
> going to help anyone, nor make you look good.

Bit of advice: read the fucking manual. Of which there are a few,
including the tutorial on http://www.python-excel.org and the API docs
for open_workbook
http://www.lexicon.net/sjmachin/xlrd.html#xlrd.open_workbook-function

It's a shame there's not way to enshrine in a license that rude lazy
people are strictly prohibited from using a particular package.

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk

Reply all
Reply to author
Forward
0 new messages