473,750 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Download excel file from web?

Hi - experienced programmer but this is my first Python program.

This URL will retrieve an excel spreadsheet containing (that day's)
msci stock index returns.

http://www.mscibarra.com/webapp/inde...EIPerfRegional

Want to write python to download and save the file.

So far I've arrived at this:

# import pdb
import urllib2
from win32com.client import Dispatch

xlApp = Dispatch("Excel .Application")

# test 1
# xlApp.Workbooks .Add()
# xlApp.ActiveShe et.Cells(1,1).V alue = 'A'
# xlApp.ActiveWor kbook.ActiveShe et.Cells(2,1).V alue = 'B'
# xlBook = xlApp.ActiveWor kbook
# xlBook.SaveAs(F ilename='C:\\te st.xls')
# pdb.set_trace()
response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional')
# test 2 - returns check = False
check_for_data = urllib2.Request ('http://www.mscibarra.c om/webapp/
indexperf/excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional').ha s_data()

xlApp = response.fp
print(response. fp.name)
print(xlApp.nam e)
xlApp.write
xlApp.Close
Jul 28 '08 #1
15 9438
On Jul 28, 3:00*pm, "p...@well. com" <p...@well.comw rote:
Hi - experienced programmer but this is my first Python program.

This URL will retrieve an excel spreadsheet containing (that day's)
msci stock index returns.

http://www.mscibarra.com/webapp/inde...vel=0&scope=0&....

Want to write python to download and save the file.

So far I've arrived at this:

# import pdb
import urllib2
from win32com.client import Dispatch

xlApp = Dispatch("Excel .Application")

# test 1
# xlApp.Workbooks .Add()
# xlApp.ActiveShe et.Cells(1,1).V alue = 'A'
# xlApp.ActiveWor kbook.ActiveShe et.Cells(2,1).V alue = 'B'
# xlBook = xlApp.ActiveWor kbook
# xlBook.SaveAs(F ilename='C:\\te st.xls')

# pdb.set_trace()
response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional')
# test 2 - returns check = False
check_for_data = urllib2.Request ('http://www.mscibarra.c om/webapp/
indexperf/excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional').ha s_data()

xlApp = response.fp
print(response. fp.name)
print(xlApp.nam e)
xlApp.write
xlApp.Close
Woops hit Send when I wanted Preview. Looks like the html [quote] tag
doesn't work from groups.google.c om (nice).

Anway, in test 1 above, I determined how to instantiate an excel
object; put some stuff in it; then save to disk.

So, in theory, I'm retrieving my excel spreadsheet with

response = urllib2.urlopen ()

Except what then do I do with this?

Well for one read some of the urllib2 documentation and found the
Request class with the method has_data() on it. It returns False.
Hmm that's not encouraging.

I supposed the trick to understand what urllib2.urlopen is returning
to me; rummage around in there; and hopefully find my excel file.

I use pdb to debug. This is interesting:

(Pdb) dir(response)
['__doc__', '__init__', '__iter__', '__module__', '__repr__', 'close',
'code', '
fileno', 'fp', 'geturl', 'headers', 'info', 'msg', 'next', 'read',
'readline', '
readlines', 'url']
(Pdb)

I suppose the members with __*_ are methods; and the names without the
underbars are attributes (variables) (?).

Or maybe this isn't at all the right direction to take (maybe there
are much better modules to do this stuff). Would be happy to learn if
that's the case (and if that gets the job done for me).

pat
Jul 28 '08 #2
pa**@well.com schrieb:[quote]
On Jul 28, 3:00 pm, "p...@well. com" <p...@well.comw rote:
>Hi - experienced programmer but this is my first Python program.

This URL will retrieve an excel spreadsheet containing (that day's)
msci stock index returns.

http://www.mscibarra.com/webapp/inde...vel=0&scope=0&...

Want to write python to download and save the file.

So far I've arrived at this:

># import pdb
import urllib2
from win32com.client import Dispatch

xlApp = Dispatch("Excel .Application")

# test 1
# xlApp.Workbooks .Add()
# xlApp.ActiveShe et.Cells(1,1).V alue = 'A'
# xlApp.ActiveWor kbook.ActiveShe et.Cells(2,1).V alue = 'B'
# xlBook = xlApp.ActiveWor kbook
# xlBook.SaveAs(F ilename='C:\\te st.xls')

# pdb.set_trace()
response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&s cope=0&currency =15&style=C&siz e=36&market=189 7&asOf=Jul
+25%2C+2008&ex port=Excel_IEIP erfRegional')
# test 2 - returns check = False
check_for_da ta = urllib2.Request ('http://www.mscibarra.c om/webapp/
indexperf/excel?
priceLevel=0&s cope=0&currency =15&style=C&siz e=36&market=189 7&asOf=Jul
+25%2C+2008&ex port=Excel_IEIP erfRegional').h as_data()

xlApp = response.fp
print(response .fp.name)
print(xlApp.na me)
xlApp.write
xlApp.Close

Woops hit Send when I wanted Preview. Looks like the html
tag
doesn't work from groups.google.c om (nice).

Anway, in test 1 above, I determined how to instantiate an excel
object; put some stuff in it; then save to disk.

So, in theory, I'm retrieving my excel spreadsheet with

response = urllib2.urlopen ()

Except what then do I do with this?

Well for one read some of the urllib2 documentation and found the
Request class with the method has_data() on it. It returns False.
Hmm that's not encouraging.

I supposed the trick to understand what urllib2.urlopen is returning
to me; rummage around in there; and hopefully find my excel file.

I use pdb to debug. This is interesting:

(Pdb) dir(response)
['__doc__', '__init__', '__iter__', '__module__', '__repr__', 'close',
'code', '
fileno', 'fp', 'geturl', 'headers', 'info', 'msg', 'next', 'read',
'readline', '
readlines', 'url']
(Pdb)

I suppose the members with __*_ are methods; and the names without the
underbars are attributes (variables) (?).
No, these are the names of all attributes and methods. read is a method,
for example.
Or maybe this isn't at all the right direction to take (maybe there
are much better modules to do this stuff). Would be happy to learn if
that's the case (and if that gets the job done for me).

The docs (http://docs.python.org/lib/module-urllib2.html) are pretty
clear on this:

"""
This function returns a file-like object with two additional methods:
"""
And then for file-like objects:

http://docs.python.org/lib/bltin-file-objects.html
"""
read( [size])
Read at most size bytes from the file (less if the read hits EOF
before obtaining size bytes). If the size argument is negative or
omitted, read all data until EOF is reached. The bytes are returned as a
string object. An empty string is returned when EOF is encountered
immediately. (For certain files, like ttys, it makes sense to continue
reading after an EOF is hit.) Note that this method may call the
underlying C function fread() more than once in an effort to acquire as
close to size bytes as possible. Also note that when in non-blocking
mode, less data than what was requested may be returned, even if no size
parameter was given.
"""

Diez
Jul 28 '08 #3
On Jul 28, 3:29*pm, "Diez B. Roggisch" <de...@nospam.w eb.dewrote:[quote]
p...@well.com schrieb:
On Jul 28, 3:00 pm, "p...@well. com" <p...@well.comw rote:
Hi - experienced programmer but this is my first Python program.
This URL will retrieve an excel spreadsheet containing (that day's)
msci stock index returns.
>http://www.mscibarra.com/webapp/inde...vel=0&scope=0&...
Want to write python to download and save the file.
So far I've arrived at this:
# import pdb
import urllib2
from win32com.client import Dispatch
xlApp = Dispatch("Excel .Application")
# test 1
# xlApp.Workbooks .Add()
# xlApp.ActiveShe et.Cells(1,1).V alue = 'A'
# xlApp.ActiveWor kbook.ActiveShe et.Cells(2,1).V alue = 'B'
# xlBook = xlApp.ActiveWor kbook
# xlBook.SaveAs(F ilename='C:\\te st.xls')
# pdb.set_trace()
response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional')
# test 2 - returns check = False
check_for_data = urllib2.Request ('http://www.mscibarra.c om/webapp/
indexperf/excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional').ha s_data()
xlApp = response.fp
print(response. fp.name)
print(xlApp.nam e)
xlApp.write
xlApp.Close
Woops hit Send when I wanted Preview. *Looks like the html
tag
doesn't work from groups.google.c om (nice).
Anway, in test 1 above, I determined how to instantiate an excel
object; put some stuff in it; then save to disk.
So, in theory, I'm retrieving my excel spreadsheet with
response = urllib2.urlopen ()
Except what then do I do with this?
Well for one read some of the urllib2 documentation and found the
Request class with the method has_data() on it. *It returns False.
Hmm that's not encouraging.
I supposed the trick to understand what urllib2.urlopen is returning
to me; rummage around in there; and hopefully find my excel file.
I use pdb to debug. *This is interesting:
(Pdb) dir(response)
['__doc__', '__init__', '__iter__', '__module__', '__repr__', 'close',
'code', '
fileno', 'fp', 'geturl', 'headers', 'info', 'msg', 'next', 'read',
'readline', '
readlines', 'url']
(Pdb)
I suppose the members with __*_ are methods; and the names without the
underbars are attributes (variables) (?).

No, these are the names of all attributes and methods. read is a method,
for example.
right - I got it backwards.
>
Or maybe this isn't at all the right direction to take (maybe there
are much better modules to do this stuff). *Would be happy to learn if
that's the case (and if that gets the job done for me).

The docs (http://docs.python.org/lib/module-urllib2.html) are pretty
clear on this:

"""
This function returns a file-like object with two additional methods:
"""

And then for file-like objects:

http://docs.python.org/lib/bltin-file-objects.html

"""
read( * [size])
* * *Read at most size bytes from the file (less if the read hits EOF
before obtaining size bytes). If the size argument is negative or
omitted, read all data until EOF is reached. The bytes are returned as a
string object. An empty string is returned when EOF is encountered
immediately. (For certain files, like ttys, it makes sense to continue
reading after an EOF is hit.) Note that this method may call the
underlying C function fread() more than once in an effort to acquire as
close to size bytes as possible. Also note that when in non-blocking
mode, less data than what was requested may be returned, even if no size
parameter was given.
"""

Diez
Just stumbled upon .read:

response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional').re ad

Now the question is: what to do with this? I'll look at the
documentation that you point to.

thanx - pat
Jul 28 '08 #4
On Jul 28, 3:33*pm, "p...@well. com" <p...@well.comw rote:[quote]
On Jul 28, 3:29*pm, "Diez B. Roggisch" <de...@nospam.w eb.dewrote:
p...@well.com schrieb:
On Jul 28, 3:00 pm, "p...@well. com" <p...@well.comw rote:
>Hi - experienced programmer but this is my first Python program.
>This URL will retrieve an excel spreadsheet containing (that day's)
>msci stock index returns.
>>http://www.mscibarra.com/webapp/inde...vel=0&scope=0&...
>Want to write python to download and save the file.
>So far I've arrived at this:
>
># import pdb
>import urllib2
>from win32com.client import Dispatch
>xlApp = Dispatch("Excel .Application")
># test 1
># xlApp.Workbooks .Add()
># xlApp.ActiveShe et.Cells(1,1).V alue = 'A'
># xlApp.ActiveWor kbook.ActiveShe et.Cells(2,1).V alue = 'B'
># xlBook = xlApp.ActiveWor kbook
># xlBook.SaveAs(F ilename='C:\\te st.xls')
># pdb.set_trace()
>response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
>excel?
>priceLevel=0&s cope=0&currency =15&style=C&siz e=36&market=189 7&asOf=Jul
>+25%2C+2008&ex port=Excel_IEIP erfRegional')
># test 2 - returns check = False
>check_for_da ta = urllib2.Request ('http://www.mscibarra.c om/webapp/
>indexperf/excel?
>priceLevel=0&s cope=0&currency =15&style=C&siz e=36&market=189 7&asOf=Jul
>+25%2C+2008&ex port=Excel_IEIP erfRegional').h as_data()
>xlApp = response.fp
>print(response .fp.name)
>print(xlApp.na me)
>xlApp.write
>xlApp.Close
>
Woops hit Send when I wanted Preview. *Looks like the html
tag
doesn't work from groups.google.c om (nice).
Anway, in test 1 above, I determined how to instantiate an excel
object; put some stuff in it; then save to disk.
So, in theory, I'm retrieving my excel spreadsheet with
response = urllib2.urlopen ()
Except what then do I do with this?
Well for one read some of the urllib2 documentation and found the
Request class with the method has_data() on it. *It returns False.
Hmm that's not encouraging.
I supposed the trick to understand what urllib2.urlopen is returning
to me; rummage around in there; and hopefully find my excel file.
I use pdb to debug. *This is interesting:
(Pdb) dir(response)
['__doc__', '__init__', '__iter__', '__module__', '__repr__', 'close',
'code', '
fileno', 'fp', 'geturl', 'headers', 'info', 'msg', 'next', 'read',
'readline', '
readlines', 'url']
(Pdb)
I suppose the members with __*_ are methods; and the names without the
underbars are attributes (variables) (?).
No, these are the names of all attributes and methods. read is a method,
for example.

right - I got it backwards.


Or maybe this isn't at all the right direction to take (maybe there
are much better modules to do this stuff). *Would be happy to learnif
that's the case (and if that gets the job done for me).
The docs (http://docs.python.org/lib/module-urllib2.html) are pretty
clear on this:
"""
This function returns a file-like object with two additional methods:
"""
And then for file-like objects:
http://docs.python.org/lib/bltin-file-objects.html
"""
read( * [size])
* * *Read at most size bytes from the file (less if the read hitsEOF
before obtaining size bytes). If the size argument is negative or
omitted, read all data until EOF is reached. The bytes are returned as a
string object. An empty string is returned when EOF is encountered
immediately. (For certain files, like ttys, it makes sense to continue
reading after an EOF is hit.) Note that this method may call the
underlying C function fread() more than once in an effort to acquire as
close to size bytes as possible. Also note that when in non-blocking
mode, less data than what was requested may be returned, even if no size
parameter was given.
"""
Diez

Just stumbled upon .read:

response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional').re ad

Now the question is: what to do with this? *I'll look at the
documentation that you point to.

thanx - pat
Or rather (next iteration):

response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional').re ad(1000000)

The file is generally something like 26 KB so specifying 1,000,000
seems like a good idea (first approximation).

And then when I do:

print(response)

I get a whole lot of garbage (and some non-garbage), so I know I'm
onto something.

When I read the .read documentation further, it says that read() has
returned the data as a string object. Now - how do I convince Python
that the string object is in fact an excel file - and save it to disk?

pat
Jul 28 '08 #5
On Mon, Jul 28, 2008 at 7:43 PM, pa**@well.com <pa**@well.comw rote:[quote]
On Jul 28, 3:33 pm, "p...@well. com" <p...@well.comw rote:
>On Jul 28, 3:29 pm, "Diez B. Roggisch" <de...@nospam.w eb.dewrote:
p...@well.com schrieb:
On Jul 28, 3:00 pm, "p...@well. com" <p...@well.comw rote:
Hi - experienced programmer but this is my first Python program.
>This URL will retrieve an excel spreadsheet containing (that day's)
msci stock index returns.
>>http://www.mscibarra.com/webapp/inde...vel=0&scope=0&...
>Want to write python to download and save the file.
>So far I've arrived at this:
>
># import pdb
import urllib2
from win32com.client import Dispatch
>xlApp = Dispatch("Excel .Application")
># test 1
# xlApp.Workbooks .Add()
# xlApp.ActiveShe et.Cells(1,1).V alue = 'A'
# xlApp.ActiveWor kbook.ActiveShe et.Cells(2,1).V alue = 'B'
# xlBook = xlApp.ActiveWor kbook
# xlBook.SaveAs(F ilename='C:\\te st.xls')
># pdb.set_trace()
response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&s cope=0&currency =15&style=C&siz e=36&market=189 7&asOf=Jul
+25%2C+2008&ex port=Excel_IEIP erfRegional')
# test 2 - returns check = False
check_for_da ta = urllib2.Request ('http://www.mscibarra.c om/webapp/
indexperf/excel?
priceLevel=0&s cope=0&currency =15&style=C&siz e=36&market=189 7&asOf=Jul
+25%2C+2008&ex port=Excel_IEIP erfRegional').h as_data()
>xlApp = response.fp
print(response .fp.name)
print(xlApp.na me)
xlApp.write
xlApp.Close
Woops hit Send when I wanted Preview. Looks like the html
tag
doesn't work from groups.google.c om (nice).
Anway, in test 1 above, I determined how to instantiate an excel
object; put some stuff in it; then save to disk.
So, in theory, I'm retrieving my excel spreadsheet with
response = urllib2.urlopen ()
Except what then do I do with this?
Well for one read some of the urllib2 documentation and found the
Request class with the method has_data() on it. It returns False.
Hmm that's not encouraging.
I supposed the trick to understand what urllib2.urlopen is returning
to me; rummage around in there; and hopefully find my excel file.
I use pdb to debug. This is interesting:
(Pdb) dir(response)
['__doc__', '__init__', '__iter__', '__module__', '__repr__', 'close',
'code', '
fileno', 'fp', 'geturl', 'headers', 'info', 'msg', 'next', 'read',
'readline', '
readlines', 'url']
(Pdb)
I suppose the members with __*_ are methods; and the names without the
underbars are attributes (variables) (?).
No, these are the names of all attributes and methods. read is a method,
for example.

right - I got it backwards.


Or maybe this isn't at all the right direction to take (maybe there
are much better modules to do this stuff). Would be happy to learn if
that's the case (and if that gets the job done for me).
The docs (http://docs.python.org/lib/module-urllib2.html) are pretty
clear on this:
"""
This function returns a file-like object with two additional methods:
"""
And then for file-like objects:
>http://docs.python.org/lib/bltin-file-objects.html
"""
read( [size])
Read at most size bytes from the file (less if the read hits EOF
before obtaining size bytes). If the size argument is negative or
omitted, read all data until EOF is reached. The bytes are returned as a
string object. An empty string is returned when EOF is encountered
immediately. (For certain files, like ttys, it makes sense to continue
reading after an EOF is hit.) Note that this method may call the
underlying C function fread() more than once in an effort to acquire as
close to size bytes as possible. Also note that when in non-blocking
mode, less data than what was requested may be returned, even if no size
parameter was given.
"""
Diez

Just stumbled upon .read:

response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&s cope=0&currency =15&style=C&siz e=36&market=189 7&asOf=Jul
+25%2C+2008&ex port=Excel_IEIP erfRegional').r ead

Now the question is: what to do with this? I'll look at the
documentatio n that you point to.

thanx - pat

Or rather (next iteration):

response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional').re ad(1000000)

The file is generally something like 26 KB so specifying 1,000,000
seems like a good idea (first approximation).

And then when I do:

print(response)

I get a whole lot of garbage (and some non-garbage), so I know I'm
onto something.

When I read the .read documentation further, it says that read() has
returned the data as a string object. Now - how do I convince Python
that the string object is in fact an excel file - and save it to disk?
You don't need to convince Python, just write it to a file.
More reading for you: http://docs.python.org/tut/node9.html
pat
--
http://mail.python.org/mailman/listinfo/python-list


--
-- Guilherme H. Polo Goncalves
Jul 28 '08 #6
On Jul 28, 3:52*pm, "Guilherme Polo" <ggp...@gmail.c omwrote:[quote]
On Mon, Jul 28, 2008 at 7:43 PM, p...@well.com <p...@well.comw rote:
On Jul 28, 3:33 pm, "p...@well. com" <p...@well.comw rote:
On Jul 28, 3:29 pm, "Diez B. Roggisch" <de...@nospam.w eb.dewrote:
p...@well.com schrieb:
On Jul 28, 3:00 pm, "p...@well. com" <p...@well.comw rote:
>Hi - experienced programmer but this is my first Python program.
>This URL will retrieve an excel spreadsheet containing (that day's)
>msci stock index returns.
>>http://www.mscibarra.com/webapp/inde...vel=0&scope=0&...
>Want to write python to download and save the file.
>So far I've arrived at this:
>
># import pdb
>import urllib2
>from win32com.client import Dispatch
>xlApp = Dispatch("Excel .Application")
># test 1
># xlApp.Workbooks .Add()
># xlApp.ActiveShe et.Cells(1,1).V alue = 'A'
># xlApp.ActiveWor kbook.ActiveShe et.Cells(2,1).V alue = 'B'
># xlBook = xlApp.ActiveWor kbook
># xlBook.SaveAs(F ilename='C:\\te st.xls')
># pdb.set_trace()
>response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
>excel?
>priceLevel=0&s cope=0&currency =15&style=C&siz e=36&market=189 7&asOf=Jul
>+25%2C+2008&ex port=Excel_IEIP erfRegional')
># test 2 - returns check = False
>check_for_da ta = urllib2.Request ('http://www.mscibarra.c om/webapp/
>indexperf/excel?
>priceLevel=0&s cope=0&currency =15&style=C&siz e=36&market=189 7&asOf=Jul
>+25%2C+2008&ex port=Excel_IEIP erfRegional').h as_data()
>xlApp = response.fp
>print(response .fp.name)
>print(xlApp.na me)
>xlApp.write
>xlApp.Close
>
Woops hit Send when I wanted Preview. *Looks like the html
tag
doesn't work from groups.google.c om (nice).
Anway, in test 1 above, I determined how to instantiate an excel
object; put some stuff in it; then save to disk.
So, in theory, I'm retrieving my excel spreadsheet with
response = urllib2.urlopen ()
Except what then do I do with this?
Well for one read some of the urllib2 documentation and found the
Request class with the method has_data() on it. *It returns False.
Hmm that's not encouraging.
I supposed the trick to understand what urllib2.urlopen is returning
to me; rummage around in there; and hopefully find my excel file.
I use pdb to debug. *This is interesting:
(Pdb) dir(response)
['__doc__', '__init__', '__iter__', '__module__', '__repr__', 'close',
'code', '
fileno', 'fp', 'geturl', 'headers', 'info', 'msg', 'next', 'read',
'readline', '
readlines', 'url']
(Pdb)
I suppose the members with __*_ are methods; and the names withoutthe
underbars are attributes (variables) (?).
No, these are the names of all attributes and methods. read is a method,
for example.
right - I got it backwards.
Or maybe this isn't at all the right direction to take (maybe there
are much better modules to do this stuff). *Would be happy to learn if
that's the case (and if that gets the job done for me).
The docs (http://docs.python.org/lib/module-urllib2.html) are pretty
clear on this:
"""
This function returns a file-like object with two additional methods:
"""
And then for file-like objects:
http://docs.python.org/lib/bltin-file-objects.html
"""
read( * [size])
* * *Read at most size bytes from the file (less if the read hits EOF
before obtaining size bytes). If the size argument is negative or
omitted, read all data until EOF is reached. The bytes are returned as a
string object. An empty string is returned when EOF is encountered
immediately. (For certain files, like ttys, it makes sense to continue
reading after an EOF is hit.) Note that this method may call the
underlying C function fread() more than once in an effort to acquireas
close to size bytes as possible. Also note that when in non-blocking
mode, less data than what was requested may be returned, even if no size
parameter was given.
"""
Diez
Just stumbled upon .read:
response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional').re ad
Now the question is: what to do with this? *I'll look at the
documentation that you point to.
thanx - pat
Or rather (next iteration):
response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional').re ad(1000000)
The file is generally something like 26 KB so specifying 1,000,000
seems like a good idea (first approximation).
And then when I do:
print(response)
I get a whole lot of garbage (and some non-garbage), so I know I'm
onto something.
When I read the .read documentation further, it says that read() has
returned the data as a string object. *Now - how do I convince Python
that the string object is in fact an excel file - and save it to disk?

You don't need to convince Python, just write it to a file.
More reading for you:http://docs.python.org/tut/node9.html
pat
--
http://mail.python.org/mailman/listinfo/python-list

--
-- Guilherme H. Polo Goncalves
OK:

response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional').re ad(1000000)
# print(response)
f = open("c:\\msci. xls",'w')
f.write(respons e)

OK this makes the file, and there's a c:\msci.xls in place and it's
about the right size. But whether I make the second param to open 'w'
or 'wb', when I try to open msci.xls from the Windows file explorer,
excel tells me that the file is corrupted.

pat
Jul 28 '08 #7
On Jul 28, 4:04*pm, "p...@well. com" <p...@well.comw rote:[quote]
On Jul 28, 3:52*pm, "Guilherme Polo" <ggp...@gmail.c omwrote:
On Mon, Jul 28, 2008 at 7:43 PM, p...@well.com <p...@well.comw rote:
On Jul 28, 3:33 pm, "p...@well. com" <p...@well.comw rote:
>On Jul 28, 3:29 pm, "Diez B. Roggisch" <de...@nospam.w eb.dewrote:
p...@well.com schrieb:
On Jul 28, 3:00 pm, "p...@well. com" <p...@well.comw rote:
>Hi - experienced programmer but this is my first Python program..
>This URL will retrieve an excel spreadsheet containing (that day's)
>msci stock index returns.
>>http://www.mscibarra.com/webapp/inde...vel=0&scope=0&...
>Want to write python to download and save the file.
>So far I've arrived at this:
>
># import pdb
>import urllib2
>from win32com.client import Dispatch
>xlApp = Dispatch("Excel .Application")
># test 1
># xlApp.Workbooks .Add()
># xlApp.ActiveShe et.Cells(1,1).V alue = 'A'
># xlApp.ActiveWor kbook.ActiveShe et.Cells(2,1).V alue = 'B'
># xlBook = xlApp.ActiveWor kbook
># xlBook.SaveAs(F ilename='C:\\te st.xls')
># pdb.set_trace()
>response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
>excel?
>priceLevel=0&s cope=0&currency =15&style=C&siz e=36&market=189 7&asOf=Jul
>+25%2C+2008&ex port=Excel_IEIP erfRegional')
># test 2 - returns check = False
>check_for_da ta = urllib2.Request ('http://www.mscibarra.c om/webapp/
>indexperf/excel?
>priceLevel=0&s cope=0&currency =15&style=C&siz e=36&market=189 7&asOf=Jul
>+25%2C+2008&ex port=Excel_IEIP erfRegional').h as_data()
>xlApp = response.fp
>print(response .fp.name)
>print(xlApp.na me)
>xlApp.write
>xlApp.Close
>
Woops hit Send when I wanted Preview. *Looks like the html
tag
doesn't work from groups.google.c om (nice).
Anway, in test 1 above, I determined how to instantiate an excel
object; put some stuff in it; then save to disk.
So, in theory, I'm retrieving my excel spreadsheet with
response = urllib2.urlopen ()
Except what then do I do with this?
Well for one read some of the urllib2 documentation and found the
Request class with the method has_data() on it. *It returns False.
Hmm that's not encouraging.
I supposed the trick to understand what urllib2.urlopen is returning
to me; rummage around in there; and hopefully find my excel file..
I use pdb to debug. *This is interesting:
(Pdb) dir(response)
['__doc__', '__init__', '__iter__', '__module__', '__repr__', 'close',
'code', '
fileno', 'fp', 'geturl', 'headers', 'info', 'msg', 'next', 'read',
'readline', '
readlines', 'url']
(Pdb)
I suppose the members with __*_ are methods; and the names without the
underbars are attributes (variables) (?).
No, these are the names of all attributes and methods. read is a method,
for example.
>right - I got it backwards.
Or maybe this isn't at all the right direction to take (maybe there
are much better modules to do this stuff). *Would be happy to learn if
that's the case (and if that gets the job done for me).
The docs (http://docs.python.org/lib/module-urllib2.html) are pretty
clear on this:
"""
This function returns a file-like object with two additional methods:
"""
And then for file-like objects:
>http://docs.python.org/lib/bltin-file-objects.html
"""
read( * [size])
* * *Read at most size bytes from the file (less if the readhits EOF
before obtaining size bytes). If the size argument is negative or
omitted, read all data until EOF is reached. The bytes are returned as a
string object. An empty string is returned when EOF is encountered
immediately. (For certain files, like ttys, it makes sense to continue
reading after an EOF is hit.) Note that this method may call the
underlying C function fread() more than once in an effort to acquire as
close to size bytes as possible. Also note that when in non-blocking
mode, less data than what was requested may be returned, even if no size
parameter was given.
"""
Diez
>Just stumbled upon .read:
>response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
>excel?
>priceLevel=0&s cope=0&currency =15&style=C&siz e=36&market=189 7&asOf=Jul
>+25%2C+2008&ex port=Excel_IEIP erfRegional').r ead
>Now the question is: what to do with this? *I'll look at the
>documentatio n that you point to.
>thanx - pat
Or rather (next iteration):
response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional').re ad(1000000)
The file is generally something like 26 KB so specifying 1,000,000
seems like a good idea (first approximation).
And then when I do:
print(response)
I get a whole lot of garbage (and some non-garbage), so I know I'm
onto something.
When I read the .read documentation further, it says that read() has
returned the data as a string object. *Now - how do I convince Python
that the string object is in fact an excel file - and save it to disk?
You don't need to convince Python, just write it to a file.
More reading for you:http://docs.python.org/tut/node9.html
pat
--
>http://mail.python.org/mailman/listinfo/python-list
--
-- Guilherme H. Polo Goncalves

OK:

response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional').re ad(1000000)
# print(response)
f = open("c:\\msci. xls",'w')
f.write(respons e)

OK this makes the file, and there's a c:\msci.xls in place and it's
about the right size. But whether I make the second param to open 'w'
or 'wb', when I try to open msci.xls from the Windows file explorer,
excel tells me that the file is corrupted.

pat
Nope - must have been stumbling over my own feet.

'wb' _is_ necessary (as I would expect).

So it works:

# pdb.set_trace()
response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional').re ad(1000000)
# print(response)
f = open("c:\\msci. xls",'wb')
f.write(respons e)
f.flush
f.close

I know the f.flush and f.close are redundant - in the sense that both
flush the contents to disk. So I can probably just take out the
f.flush.

Thanx for the help.

pat
Jul 28 '08 #8
On Mon, Jul 28, 2008 at 8:04 PM, pa**@well.com <pa**@well.comw rote:[quote]
On Jul 28, 3:52 pm, "Guilherme Polo" <ggp...@gmail.c omwrote:
>On Mon, Jul 28, 2008 at 7:43 PM, p...@well.com <p...@well.comw rote:
On Jul 28, 3:33 pm, "p...@well. com" <p...@well.comw rote:
On Jul 28, 3:29 pm, "Diez B. Roggisch" <de...@nospam.w eb.dewrote:
p...@well.com schrieb:
On Jul 28, 3:00 pm, "p...@well. com" <p...@well.comw rote:
Hi - experienced programmer but this is my first Python program.
>This URL will retrieve an excel spreadsheet containing (that day's)
msci stock index returns.
>>http://www.mscibarra.com/webapp/inde...vel=0&scope=0&...
>Want to write python to download and save the file.
>So far I've arrived at this:
>
># import pdb
import urllib2
from win32com.client import Dispatch
>xlApp = Dispatch("Excel .Application")
># test 1
# xlApp.Workbooks .Add()
# xlApp.ActiveShe et.Cells(1,1).V alue = 'A'
# xlApp.ActiveWor kbook.ActiveShe et.Cells(2,1).V alue = 'B'
# xlBook = xlApp.ActiveWor kbook
# xlBook.SaveAs(F ilename='C:\\te st.xls')
># pdb.set_trace()
response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&s cope=0&currency =15&style=C&siz e=36&market=189 7&asOf=Jul
+25%2C+2008&ex port=Excel_IEIP erfRegional')
# test 2 - returns check = False
check_for_da ta = urllib2.Request ('http://www.mscibarra.c om/webapp/
indexperf/excel?
priceLevel=0&s cope=0&currency =15&style=C&siz e=36&market=189 7&asOf=Jul
+25%2C+2008&ex port=Excel_IEIP erfRegional').h as_data()
>xlApp = response.fp
print(response .fp.name)
print(xlApp.na me)
xlApp.write
xlApp.Close
Woops hit Send when I wanted Preview. Looks like the html
tag
doesn't work from groups.google.c om (nice).
Anway, in test 1 above, I determined how to instantiate an excel
object; put some stuff in it; then save to disk.
So, in theory, I'm retrieving my excel spreadsheet with
response = urllib2.urlopen ()
Except what then do I do with this?
Well for one read some of the urllib2 documentation and found the
Request class with the method has_data() on it. It returns False.
Hmm that's not encouraging.
I supposed the trick to understand what urllib2.urlopen is returning
to me; rummage around in there; and hopefully find my excel file.
I use pdb to debug. This is interesting:
(Pdb) dir(response)
['__doc__', '__init__', '__iter__', '__module__', '__repr__', 'close',
'code', '
fileno', 'fp', 'geturl', 'headers', 'info', 'msg', 'next', 'read',
'readline', '
readlines', 'url']
(Pdb)
I suppose the members with __*_ are methods; and the names without the
underbars are attributes (variables) (?).
No, these are the names of all attributes and methods. read is a method,
for example.
>right - I got it backwards.
Or maybe this isn't at all the right direction to take (maybe there
are much better modules to do this stuff). Would be happy to learn if
that's the case (and if that gets the job done for me).
The docs (http://docs.python.org/lib/module-urllib2.html) are pretty
clear on this:
"""
This function returns a file-like object with two additional methods:
"""
And then for file-like objects:
>http://docs.python.org/lib/bltin-file-objects.html
"""
read( [size])
Read at most size bytes from the file (less if the read hits EOF
before obtaining size bytes). If the size argument is negative or
omitted, read all data until EOF is reached. The bytes are returned as a
string object. An empty string is returned when EOF is encountered
immediately. (For certain files, like ttys, it makes sense to continue
reading after an EOF is hit.) Note that this method may call the
underlying C function fread() more than once in an effort to acquire as
close to size bytes as possible. Also note that when in non-blocking
mode, less data than what was requested may be returned, even if no size
parameter was given.
"""
Diez
>Just stumbled upon .read:
>response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&s cope=0&currency =15&style=C&siz e=36&market=189 7&asOf=Jul
+25%2C+2008&ex port=Excel_IEIP erfRegional').r ead
>Now the question is: what to do with this? I'll look at the
documentatio n that you point to.
>thanx - pat
Or rather (next iteration):
response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional').re ad(1000000)
The file is generally something like 26 KB so specifying 1,000,000
seems like a good idea (first approximation).
And then when I do:
print(response)
I get a whole lot of garbage (and some non-garbage), so I know I'm
onto something.
When I read the .read documentation further, it says that read() has
returned the data as a string object. Now - how do I convince Python
that the string object is in fact an excel file - and save it to disk?

You don't need to convince Python, just write it to a file.
More reading for you:http://docs.python.org/tut/node9.html
pat
--
http://mail.python.org/mailman/listinfo/python-list

--
-- Guilherme H. Polo Goncalves

OK:

response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional').re ad(1000000)
# print(response)
f = open("c:\\msci. xls",'w')
f.write(respons e)
I would initially change that to:

response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/excel?priceLeve l=0&scope=0&cur rency=15&style= C&size=36&marke t=1897&asOf=Jul +25%2C+2008&exp ort=Excel_IEIPe rfRegional')

f = open("c:\\msci. xls", "wb")
for line in response:
f.write(line)
f.close()

and then..
>
OK this makes the file, and there's a c:\msci.xls in place and it's
about the right size. But whether I make the second param to open 'w'
or 'wb', when I try to open msci.xls from the Windows file explorer,
excel tells me that the file is corrupted.
try it.
>
pat
--
http://mail.python.org/mailman/listinfo/python-list


--
-- Guilherme H. Polo Goncalves
Jul 28 '08 #9
On Jul 28, 4:20*pm, "Guilherme Polo" <ggp...@gmail.c omwrote:[quote]
On Mon, Jul 28, 2008 at 8:04 PM, p...@well.com <p...@well.comw rote:
On Jul 28, 3:52 pm, "Guilherme Polo" <ggp...@gmail.c omwrote:
On Mon, Jul 28, 2008 at 7:43 PM, p...@well.com <p...@well.comw rote:
On Jul 28, 3:33 pm, "p...@well. com" <p...@well.comw rote:
On Jul 28, 3:29 pm, "Diez B. Roggisch" <de...@nospam.w eb.dewrote:
p...@well.com schrieb:
On Jul 28, 3:00 pm, "p...@well. com" <p...@well.comw rote:
>Hi - experienced programmer but this is my first Python program.
>This URL will retrieve an excel spreadsheet containing (that day's)
>msci stock index returns.
>>http://www.mscibarra.com/webapp/inde...vel=0&scope=0&...
>Want to write python to download and save the file.
>So far I've arrived at this:
>
># import pdb
>import urllib2
>from win32com.client import Dispatch
>xlApp = Dispatch("Excel .Application")
># test 1
># xlApp.Workbooks .Add()
># xlApp.ActiveShe et.Cells(1,1).V alue = 'A'
># xlApp.ActiveWor kbook.ActiveShe et.Cells(2,1).V alue = 'B'
># xlBook = xlApp.ActiveWor kbook
># xlBook.SaveAs(F ilename='C:\\te st.xls')
># pdb.set_trace()
>response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
>excel?
>priceLevel=0&s cope=0&currency =15&style=C&siz e=36&market=189 7&asOf=Jul
>+25%2C+2008&ex port=Excel_IEIP erfRegional')
># test 2 - returns check = False
>check_for_da ta = urllib2.Request ('http://www.mscibarra.c om/webapp/
>indexperf/excel?
>priceLevel=0&s cope=0&currency =15&style=C&siz e=36&market=189 7&asOf=Jul
>+25%2C+2008&ex port=Excel_IEIP erfRegional').h as_data()
>xlApp = response.fp
>print(response .fp.name)
>print(xlApp.na me)
>xlApp.write
>xlApp.Close
>
Woops hit Send when I wanted Preview. *Looks like the html
tag
doesn't work from groups.google.c om (nice).
Anway, in test 1 above, I determined how to instantiate an excel
object; put some stuff in it; then save to disk.
So, in theory, I'm retrieving my excel spreadsheet with
response = urllib2.urlopen ()
Except what then do I do with this?
Well for one read some of the urllib2 documentation and found the
Request class with the method has_data() on it. *It returns False.
Hmm that's not encouraging.
I supposed the trick to understand what urllib2.urlopen is returning
to me; rummage around in there; and hopefully find my excel file.
I use pdb to debug. *This is interesting:
(Pdb) dir(response)
['__doc__', '__init__', '__iter__', '__module__', '__repr__', 'close',
'code', '
fileno', 'fp', 'geturl', 'headers', 'info', 'msg', 'next', 'read',
'readline', '
readlines', 'url']
(Pdb)
I suppose the members with __*_ are methods; and the names without the
underbars are attributes (variables) (?).
No, these are the names of all attributes and methods. read is a method,
for example.
right - I got it backwards.
Or maybe this isn't at all the right direction to take (maybe there
are much better modules to do this stuff). *Would be happy tolearn if
that's the case (and if that gets the job done for me).
The docs (http://docs.python.org/lib/module-urllib2.html) are pretty
clear on this:
"""
This function returns a file-like object with two additional methods:
"""
And then for file-like objects:
http://docs.python.org/lib/bltin-file-objects.html
"""
read( * [size])
* * *Read at most size bytes from the file (less if the read hits EOF
before obtaining size bytes). If the size argument is negative or
omitted, read all data until EOF is reached. The bytes are returned as a
string object. An empty string is returned when EOF is encountered
immediately. (For certain files, like ttys, it makes sense to continue
reading after an EOF is hit.) Note that this method may call the
underlying C function fread() more than once in an effort to acquire as
close to size bytes as possible. Also note that when in non-blocking
mode, less data than what was requested may be returned, even if no size
parameter was given.
"""
Diez
Just stumbled upon .read:
response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional').re ad
Now the question is: what to do with this? *I'll look at the
documentation that you point to.
thanx - pat
Or rather (next iteration):
response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional').re ad(1000000)
The file is generally something like 26 KB so specifying 1,000,000
seems like a good idea (first approximation).
And then when I do:
print(response)
I get a whole lot of garbage (and some non-garbage), so I know I'm
onto something.
When I read the .read documentation further, it says that read() has
returned the data as a string object. *Now - how do I convince Python
that the string object is in fact an excel file - and save it to disk?
You don't need to convince Python, just write it to a file.
More reading for you:http://docs.python.org/tut/node9.html
pat
--
http://mail.python.org/mailman/listinfo/python-list
--
-- Guilherme H. Polo Goncalves
OK:
response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/
excel?
priceLevel=0&sc ope=0&currency= 15&style=C&size =36&market=1897 &asOf=Jul
+25%2C+2008&exp ort=Excel_IEIPe rfRegional').re ad(1000000)
# print(response)
f = open("c:\\msci. xls",'w')
f.write(respons e)

I would initially change that to:

response = urllib2.urlopen ('http://www.mscibarra.c om/webapp/indexperf/excel?priceLeve l=0&scope=0&... )

f = open("c:\\msci. xls", "wb")
for line in response:
* * f.write(line)
f.close()

and then..
OK this makes the file, and there's a c:\msci.xls in place and it's
about the right size. But whether I make the second param to open 'w'
or 'wb', when I try to open msci.xls from the Windows file explorer,
excel tells me that the file is corrupted.

try it.
pat
--
http://mail.python.org/mailman/listinfo/python-list

--
-- Guilherme H. Polo Goncalves
A simple f.write(respons e) does work (click on a single row in Excel
and you get a single row).

But I can see that what you recommend Guilherme is probably safer -
thanx.

pat
Jul 28 '08 #10

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

Similar topics

3
12670
by: jim | last post by:
I'm trying to stream a html page to the user as an excel file. I'm currently using Response.ContentType = "application/vnd.ms-excel" Response.AddHeader "Content-Disposition", "inline; filename=download.xls " The actual streaming and excel file are working fine but in excel its not picking up the filename its actually showing up as the url to the page that downloads this. I
0
1907
by: Cathy Bro | last post by:
I have been able to create and Active Server Page that when I link to it will ask if I want to download to an excel file which I do want. It works well, but there is one thing that I haven't been able to get to work yet. The ASP page has a logo picture in it and I want the picture to download into the excel file also. It doesn't. My code is the following: Response.ContentType = "application/vnd.ms-excel"
0
587
by: Pankaj Garg | last post by:
I have written a program, where I download reports in PDF or Excel format, depends on user selection. My code is working fine for PDF format, but same code os not working for excel file. When I execute the code, A dialog box appears, itr shows the file name that is same as my aspx file name, with aspx extension (like showreport.aspx), instead of xls extension. I have also verified valid excel file exists at that location from where I am...
4
21843
by: Ali | last post by:
I need a functionality where my clients download Excel files and after they do, I do some processing. Downloading is easily achieved using a anchor or hyperlink tag, but that does not give me the full functionality I am after. So, I came up with a way to download the files using a stream but after I download the file and try to open it in Excel I get garbage. This is the code I use for the download function. Please help if you have any...
1
2227
by: Daniel | last post by:
Hi, can u explain to me what is the path need to use in order to upload and download the file based on below solution: 1.Set up a folder that both the web app and SQL server can get to. 2.Do a simple file upload from the web app what is DTS package and how to apply it? 3.Set up a DTS package to periodically check the folder to do an import. Your help will be appreciated.
1
1346
by: ksskumar2000 | last post by:
Hi Friends, What I want: If the user click a hyperlink, I have to download a .CSV file into the users machine. What I tried: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl="Sample.csv">download file.</asp:HyperLink>
1
1790
by: farhana | last post by:
Hi experts, Need ur help and advice, My excel file is for user to upload their product listing. I have created a macro programming in the excel file. To use the file, user need to download it from my system. My concern is i want the userId to be in the excel file as it will be used in the excel for inserting data.
2
2009
by: thanawala27 | last post by:
Hi. I want to download an Excel file from the server and am using the following code. <input type=button value="Click To Download" onClick="location.href='Logs.xls'"> On clicking this button, I get the following Error.
0
1306
by: angelgal | last post by:
Hi ALL, I have to download a file from web and upload in MS SQLSERVER 2005. However, the problem i am facing is that the file i download in in web page format though it shows excel format. I have to open the file and save as excel workbook and then upload through vb.net using following syntax: 1. I use Process.Start("http://www.xxx/x/Downloadone.asp") and i click on download button to download the file and save dialogue appear to save but...
0
8839
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9584
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9344
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9257
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4716
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4893
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3327
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2226
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.