How to define Excel Named Ranges?

307 views
Skip to first unread message

Gabriel Lima

unread,
Dec 16, 2009, 8:22:11 PM12/16/09
to python-excel
I'm having trouble working with xlrd, xlwt and xlutils
I can write the values i need to, but I also need to define a name to
specific cells.

so, when I do:

wb = xlwt.Workbook()
ws = wb.add_sheet('Plan0')
ws.write(0, 0, 'Test', style0)

I want to define that cell, in case, (0,0), to have a defined name
Like when we are in Excel, and click in that top left box, named "Name
Box", and define a relative name to a cell or a range of cells.

In my case, to be easy, i just want to define a name to a single cell.

I read the documentation of xlwt, and found that it's not possible
today.

But, could anyone suggest a workaround?

I really need to define this name. The proposit is that another
program read this "variable", in case, the defined name, cause this
application can't read a "A0" cell, only defined names.

Thank's everybody.

John Machin

unread,
Dec 16, 2009, 10:39:12 PM12/16/09
to python...@googlegroups.com
On 17/12/2009 12:22 PM, Gabriel Lima wrote:
> I'm having trouble working with xlrd, xlwt and xlutils
> I can write the values i need to, but I also need to define a name to
> specific cells.
>
> I read the documentation of xlwt, and found that it's not possible
> today.

> But, could anyone suggest a workaround?

Sorry, I can't think of any workaround other than adding the name
definition using Excel/COM.

> I really need to define this name. The proposit is that another
> program read this "variable", in case, the defined name, cause this
> application can't read a "A0" cell, only defined names.

I trust that you mean A1, not A0. Are you sure it won't accept a cell
range? What application, and what error message(s) do you get if you try
A1 and A1:A1 and Sheet1!A1:A1?

Gabriel Lima de Oliveira

unread,
Dec 16, 2009, 10:47:36 PM12/16/09
to python...@googlegroups.com
Well, sorry, I mean A1.

But I didn't try A1:A1 and Sheet1!A1:A1.

I'm not with the program right now, but its name is Arena, it's a program used for Industrial Simulation, that can read data from .xls files.
Tomorrow I'll be with the program, and try this workarounds. Hopefully I will have success.

Thanks for help. I'll try.


--

You received this message because you are subscribed to the Google Groups "python-excel" group.
To post to this group, send an email to python...@googlegroups.com.
To unsubscribe from this group, send email to python-excel...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/python-excel?hl=en-GB.



Gabriel Lima de Oliveira

unread,
Dec 16, 2009, 10:48:15 PM12/16/09
to python...@googlegroups.com

Gabriel Lima de Oliveira

unread,
Dec 17, 2009, 2:19:36 PM12/17/09
to python...@googlegroups.com
[SOLVED]

Thank you, John Machin. Thank you so much.

The ranged A1:A1 worked!
I finally did it.

Now I'll not use ranged names anymore.

Thank you for help.
Reply all
Reply to author
Forward
0 new messages