473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Set Excel cell to a value using Python

Elias Alhanatis
Hello everybody!!!

I have made an application using python and wxpython , and now i want to
print some statistics through my application. I have prepared an Excel form
to fill with the statistics , and i have succeded in opening this 'form' from python.
My problem is that i cannot go on from that point , to set some of the cells in this
'form' to the values i need.
I have used some snippets from various sites but they did not work.
I need help only on this simple point: How to set a cell of an opened excel file to a certain value.

Any code , or initial 'guidence' will be helpfull!!
Thank you all in advance!!!
Mar 18 '08 #1
3 3912
dazzler
75
could you please show us how have you opened this excel form...
Mar 19 '08 #2
elcron
43
I believe their is a module to read and write excel files but you could always just save it as a CSV file (comma separated values) and write a quick reader for it.
Mar 19 '08 #3
Hello friends!

One of the scripts i used to do what i want was:
Expand|Select|Wrap|Line Numbers
  1. # -*- coding: cp1253 -*-
  2.  
  3. from win32com.client import Dispatch
  4. xlApp = Dispatch ("Excel.Application")
  5. xlWb = xlApp.Workbooks.Open ("C:\\Python25\\Misthos.xlsx")
  6. xlSht = xlWb.Worksheets (1)
  7.  
  8. xlSht.Cells(1,2).Value="Elias"
  9. xlSht.Cells(2,2).Value="Ηλιας"
  10.  
( i Work on Excel 2007 & Vista )

With that code , i get an error like:
....lines ommited
File "C:\Python25\lib\site-packages\win32com\client\__init__.py" , line 448 in _ApplyTypes
dispid, 0, wFlags, retType, argType, *args),
com_error: ( -2147352573, 'Member not found.', None, None)

I've tried also the same snippet on windows XP with Excel 2007 and it
actually worked....

Any suggestions?

Thank you all in advance!
Mar 21 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
2
by: Kumar | last post by:
Hi Folks, I have a question regarding my windows c# application. This application just reads MS Excel file and puts the data in to sql server database. In that excel file ,it has one named cell...
3
by: Carlos Magalhaes | last post by:
Hey All, I am doing some excel automation using the excel COM. I can do most of the functions and its working well until I come across a formula. I can run a formula and insert the formula...
18
by: Frank M. Walter | last post by:
Hello, I have made an small AddIn with udf for excel 2003. I use vs2003. The point of view is the function __T() I call it in excel sheet writing =__T() I am not able to set a value to a...
3
by: implicate_order | last post by:
Greetings, I'm new to python and am in the process of writing a script to parse some CSV data, spread it across multiple Excel worksheets and then generate charts. I searched the internet to...
12
by: kath | last post by:
How do I read an Excel file in Python? I have found a package to read excel file, which can be used on any platform. http://www.lexicon.net/sjmachin/xlrd.htm I installed and working on the...
2
by: Ch Pravin | last post by:
Hi All: I am having the following xml which i need to convert to excel using xslt. Please help me out. Afghanistan.xml <?xml version="1.0" encoding="utf-16"?> <Languages...
0
by: nphankey | last post by:
I'm struggling to tame Excel using Python and COM. Most of the following code is working except for the setting of the activesheet. Also, I would like to know how to release a COM object...
2
hemantbasva
by: hemantbasva | last post by:
Note We need to have a template on server for generating report in multiple sheet as we do not had msoffice on server moreover this require a batch job to delete excel file created by the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.