By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,366 Members | 2,928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,366 IT Pros & Developers. It's quick & easy.

Embedding a chart in excel

P: n/a
I'm having trouble scripting Excel to embed a chart from python.

Say I have created a sheet object and a workbook object, "xlSheet" and
"xlBook".

Creating a chart in front of my sheet is as easy as:

xlSheet.Select()
xlChart = xlBook.Charts.Add()

Now how do I tell it to go embed itself in my sheet? In VBA, it might be
something like:

xlChart.Location Where:=xlLocationAsObject, Name:=xlSheet.Name

Thanks.

(Is there a newsgroup/list with more of a focus on issues like this than
c.l.py?)

-- Stephen

Jul 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hello,
Refer the following link:
http://groups.google.com/groups?hl=e...gle.com#link11

Does it help you? If it doesn't, let me know what improvements are
required.

Regards,
Srijit

Stephen Boulet <St************@no.spam.motorola.com> wrote in message news:<bi**********@newshost.mot.com>...
I'm having trouble scripting Excel to embed a chart from python.

Say I have created a sheet object and a workbook object, "xlSheet" and
"xlBook".

Creating a chart in front of my sheet is as easy as:

xlSheet.Select()
xlChart = xlBook.Charts.Add()

Now how do I tell it to go embed itself in my sheet? In VBA, it might be
something like:

xlChart.Location Where:=xlLocationAsObject, Name:=xlSheet.Name

Thanks.

(Is there a newsgroup/list with more of a focus on issues like this than
c.l.py?)

-- Stephen

Jul 18 '05 #2

P: n/a
Very nice. I was working on my own excel classes, but I see this does lots.

Im my example, I can see from the code that arguments to the Add method
aren't optional. Thanks.

Maybe this should be in the python cookbook?

-- Stephen

sr****@yahoo.com wrote:
Hello,
Refer the following link:
http://groups.google.com/groups?hl=e...gle.com#link11

Does it help you? If it doesn't, let me know what improvements are
required.

Regards,
Srijit

Stephen Boulet <St************@no.spam.motorola.com> wrote in message news:<bi**********@newshost.mot.com>...
I'm having trouble scripting Excel to embed a chart from python.

Say I have created a sheet object and a workbook object, "xlSheet" and
"xlBook".

Creating a chart in front of my sheet is as easy as:

xlSheet.Select()
xlChart = xlBook.Charts.Add()

Now how do I tell it to go embed itself in my sheet? In VBA, it might be
something like:

xlChart.Location Where:=xlLocationAsObject, Name:=xlSheet.Name

Thanks.

(Is there a newsgroup/list with more of a focus on issues like this than
c.l.py?)

-- Stephen


Jul 18 '05 #3

P: n/a
Hello,
Can you send me the code? In the mean time I shall check setcell.

Regards,
Srijit

Stephen Boulet <St************@no.spam.motorola.com> wrote in message news:<bi**********@newshost.mot.com>...
There seems to be a problem with UseExcel.setcell:
>>> a.setcell(sht1.Name,1,(1,1))

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "excel_from_google.py", line 139, in setcell
sht.Cells(row, col).Font.FontSize = fontSize
File "C:\Python23\lib\site-packages\win32com\client\dynamic.py", line
504, in __setattr__
raise AttributeError, "Property '%s.%s' can not be set." %
(self._username_, attr)
AttributeError: Property '<unknown>.FontSize' can not be set.

Jul 18 '05 #4

P: n/a
Hello,
Can you send me the code? In the mean time I shall check setcell.

Regards,
Srijit

Stephen Boulet <St************@no.spam.motorola.com> wrote in message news:<bi**********@newshost.mot.com>...
There seems to be a problem with UseExcel.setcell:
>>> a.setcell(sht1.Name,1,(1,1))

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "excel_from_google.py", line 139, in setcell
sht.Cells(row, col).Font.FontSize = fontSize
File "C:\Python23\lib\site-packages\win32com\client\dynamic.py", line
504, in __setattr__
raise AttributeError, "Property '%s.%s' can not be set." %
(self._username_, attr)
AttributeError: Property '<unknown>.FontSize' can not be set.

Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.