[python-win32] PythonWin And Excel Problem

Smith, Brian (CR) smithbk at aecl.ca
Fri Dec 1 15:52:22 CET 2006


Hi Andrea,

> therand = []
> for ii in xrange(10):
>     therand.append(random.random())
> ...
> sheet.Range("A1:A10").Value = therand
 
I believe that when setting the value for a range, you must supply a list of
row data, where each piece of row data is a list of column data.  In other
words, a list of lists.
 
I think your problem will be fixed if you change your code to
 
for ii in xrange(10):
    therand.append((random.random(),))
 
Brian
 
 
CONFIDENTIAL AND PRIVILEGED INFORMATION NOTICE

This e-mail, and any attachments, may contain information that
is confidential, subject to copyright, or exempt from disclosure.
Any unauthorized review, disclosure, retransmission, 
dissemination or other use of or reliance on this information 
may be unlawful and is strictly prohibited.  

AVIS D'INFORMATION CONFIDENTIELLE ET PRIVILÉGIÉE

Le présent courriel, et toute pièce jointe, peut contenir de 
l'information qui est confidentielle, régie par les droits 
d'auteur, ou interdite de divulgation. Tout examen, 
divulgation, retransmission, diffusion ou autres utilisations 
non autorisées de l'information ou dépendance non autorisée 
envers celle-ci peut être illégale et est strictement interdite.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20061201/1aa1e453/attachment.html 


More information about the Python-win32 mailing list