473,396 Members | 1,671 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,396 software developers and data experts.

getting a value from a web-page

Hello:

Is it possible to get a row from a text-file? This text-file is located in a web page.
And a value from an excel located in a web-server? (Sheet1!cell A1)

Regards
Jul 18 '05 #1
4 2032
> Is it possible to get a row from a text-file? This text-file is located
in a web page.
I'm not sure exactly what it is you are trying to achieve, but you
might be able to use the urllib() module to download the file. I
recall the existence of a module which can efficiently extract
specified rows from a text file - but, alas, I don't recall its name.
But it wouldn't be strictly necessary, anyway.
And a value from an excel located in a web-server? (Sheet1!cell A1)


Do you mean an excel file located on your server, or somebody else's
server? If it is on your server, you could manipulate the file
directly using Mark Hammond's excellent win32all:
http://starship.python.net/crew/mhammond/

A typical piece of python code to manipulate Excel is:

# this example starts Excel, creates a new workbook,
# puts some text in the first and second cell
# closes the workbook without saving the changes
# and closes Excel. This happens really fast, so
# you may want to comment out some lines and add them
# back in one at a time ... or do the commands interactively
from win32com.client import Dispatch
xlApp = Dispatch("Excel.Application")
xlApp.Visible = 1
xlApp.Workbooks.Add()
xlApp.ActiveSheet.Cells(1,1).Value = 'Python Rules!'
xlApp.ActiveWorkbook.ActiveSheet.Cells(1,2).Value = 'Python Rules 2!'
xlApp.Close(SaveChanges=0)
xlApp.Quit()
del xlApp

# raw_input("press Enter ...")
Jul 18 '05 #2
> > Is it possible to get a row from a text-file? This text-file is located
in a web page.


I'm not sure exactly what it is you are trying to achieve, but you
might be able to use the urllib() module to download the file. I
recall the existence of a module which can efficiently extract
specified rows from a text file - but, alas, I don't recall its name.
But it wouldn't be strictly necessary, anyway.


Have a look at 'linecache' module. This will only work with a
local file, though, so you need to retrieve the file, see
urllib.urlretrieve() at:

http://www.python.org/doc/current/li...le-urllib.html

See also:
http://www.python.org/doc/current/li...linecache.html
and:
http://gnosis.cx/TPiP/chap1.txt (a chapter of David Mertz's book
'Text Processing in Python').
Jul 18 '05 #3
Mark Carter wrote:
And a value from an excel located in a web-server? (Sheet1!cell A1)


Do you mean an excel file located on your server, or somebody else's
server? If it is on your server, you could manipulate the file
directly using Mark Hammond's excellent win32all:
http://starship.python.net/crew/mhammond/


Is it possible to do so without Windows?

Gerrit.

--
173. If this woman bear sons to her second husband, in the place to
which she went, and then die, her earlier and later sons shall divide the
dowry between them.
-- 1780 BC, Hammurabi, Code of Law
--
Asperger Syndroom - een persoonlijke benadering:
http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
http://www.sp.nl/

Jul 18 '05 #4
Gerrit Holl wrote:
Mark Carter wrote:
> And a value from an excel located in a web-server? (Sheet1!cell A1)


Do you mean an excel file located on your server, or somebody else's
server? If it is on your server, you could manipulate the file
directly using Mark Hammond's excellent win32all:
http://starship.python.net/crew/mhammond/


Is it possible to do so without Windows?


No, win32all only runs on Windows (perhaps it might be ported to
WINE or something, but I know of nothing like that ever being done).
Microsoft Excel can run just fine on Linux thanks to "Crossover
Office" (or, presumably, other versions of Wine, too), but I do
not know how to "programmatically" drive it from Python under
such environments.

One possibility might be to use OpenOffice 1.1 (which is able to
open and read XLS files, and can in turn be driven by Python with
the new "Python-UNO bridge" included in OO release 1.1) -- but I
have, as yet, no practical experience doing that.
Alex

Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: s99999999s2003 | last post by:
hi the database "execute" function returns a list of logical results. Each logical result is a list of row tuples, as explained in the documents. everytime i use it to execute various...
4
by: kscdavefl | last post by:
I ahve a datagrid on a web form. I need to change the value in column 3 as follows. If the value in column 3 reads 0, I want to change it to read YES. How can I accomplish this task. ...
5
by: Jason | last post by:
I've been trying to figure out a good way to do this but haven't had much luck, any input would be greatly appreciated. Basically, after a datagrid is sorted, how can I get the primary key value...
5
by: velu | last post by:
Problem in getting value from textbox & radiobuttonlist to a valuable inside a datagid. I want to insert a record into a table thru datagrid. Here is the code (see below) Private Sub...
5
by: Nathan Sokalski | last post by:
I have a user control that contains three variables which are accessed through public properties. They are declared immediately below the "Web Form Designer Generated Code" section. Every time an...
5
by: Xero | last post by:
hi. i have written this code to get the text in a NumericUpDown control: nudQuestions.Text and i start the application in debug mode and use the arrow keys that come with the numeric up down...
6
by: WT | last post by:
Hello, Using VS2005. I have an assembly library that can be called from a Web site asp.net application or from a winform application. From this library I need to retrieve a path using simply a...
1
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I can successfully insert and update the oracle database by calling a oracles stored proc from my .net code. This oracle stored proc is returning some value. I cannot see that...
1
by: PulkitZery | last post by:
Hi, I am getting the following error when calling a method which i defined in web service. Any Idea?...
5
by: tshad | last post by:
I have the following class in my VS 2008 project that has a namespace of MyFunctions. ********************************* Imports System Imports System.Text.RegularExpressions Namespace...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.