Write in a cell by cell name

82 views
Skip to first unread message

arindam

unread,
Feb 13, 2012, 6:19:20 PM2/13/12
to python-excel
Hi ,

I have a list of cell names which i returned through a function using
xlrd .

Now i want to write to the same file later using the cell names
(xlrd.cellname(rowx,colx)) . I observed that xlwt only allows to
write
using sheet.write(r,c,'Text') . How can i write using cell name?
Or is there a way through which i can get the row and column from the
cell name (I dont think that will be wise to do as we dont know which
cells have been used in the excel sheet)

John Machin

unread,
Feb 13, 2012, 8:58:11 PM2/13/12
to python...@googlegroups.com

| >>> from xlwt.Utils import cell_to_rowcol2
| >>> cell_to_rowcol2('A1')
| (0, 0)
| >>> cell_to_rowcol2('IV65536')
| (65535, 255)

There is a fixed correspondence between "cell name" and (row_index, column_index). I don't understand the relevance of "we dont know which cells have been used in the excel sheet".

arindam

unread,
Feb 14, 2012, 3:49:47 AM2/14/12
to python...@googlegroups.com
Hi Sir , 

Thank you very much for the solution . This is exactly what I was searching for . When I said "I don't think that will be wise to do as we dont know which 
cells have been used in the excel sheet" , I meant , if a user suppose deletes a whole column  , then we cannot know which cells are actually present by using row and column number  . We need  a fixed correspondence is exactly what solution you gave me . 

Thanks Again Sir. Now I can advance in my work. 

Reply all
Reply to author
Forward
0 new messages