Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
How can I parse this file?
Old 06-19-2006, 03:29 PM How can I parse this file?
Webmaster Talker

Posts: 626
Trades: 0
I am looking to parse an ASP file which contains an excel sread sheet.

The address bar shows www.somewhere.com/page.asp but it actually shows in the browser like an EXCEL spread sheet. I was wondering if there is a way to parse this or just extract information out of the cells (ie. get value of cell B1 and C3 and D4, etc.).

If anyone can direct me to the right place that would be great. Either sample code or a tutorial or something.

I did a search on google but nothing really came up, I think because I really don't know what to search for.

Any help is appreciated.
jim.thornton is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-19-2006, 03:37 PM Re: How can I parse this file?
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
I'm pretty sure what you are seeing is a html page that is designed to mimic an Excel spreadsheet. So, for a simple answer, NO. I'm sure you would have to build a custom interpeter to extract the right information, and that could become a real nightmare!!
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 06-20-2006, 11:35 PM Re: How can I parse this file?
Webmaster Talker

Posts: 626
Trades: 0
I'm not sure if it is html or not. It looks exactly like EXCEL except that it is inside an IE window. If I go to the View menu, there is no option to view source. However, I did go back to the page after reading your email, and have noticed that if I go to the File menu I can select "Save As" and save it in many different formats includig CSV - Comma delimited, XLS - Excel, etc.

Now that I have figured that out that I can just save the file, is there a way that I can create a script to automatically go to the page and save the contents as a CSV comma delimited file??
jim.thornton is offline
Reply With Quote
View Public Profile
 
Old 06-21-2006, 10:48 AM Re: How can I parse this file?
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
OK - It looks like an Excel spreadsheet beacause it is an Excel spreadsheet. Excel is opening in the browser because IE has a plugin to do so (similar to Acrobat opening PDFs in the browser).

You might be opening either a XLS or CSV or other online file that triggered Excel to launch in the browser. Go to the source link, right-click (for windows) and select Save Target As... to download the file.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 06-21-2006, 03:28 PM Re: How can I parse this file?
Webmaster Talker

Posts: 626
Trades: 0
Okay, I did as suggested and when I went to save the target I got an error message. I looks as the the link calls on a javascript function popUpReport('RatesReportExcel.asp').

I went to the page from Firefox and I clicked the link... I stopped it from opening Excel and I saved the file instead. It saved as RatesReportExcel.asp.xls and I successfully opened it in excel.

So I guess my question should now be... How do I set up a script to automatically download and save this xls file, then open it and get the data from the following cells:

A3, B3, B6:B14, C6:C14

It is a really big spreadsheet but I only need the above cell info. Can someone help me with that??
jim.thornton is offline
Reply With Quote
View Public Profile
 
Old 06-22-2006, 11:16 PM Re: How can I parse this file?
Webmaster Talker

Posts: 626
Trades: 0
I have just tried looking at the file further.

I figured out how to read the .xls file when I saved it using firefox.

I am now wondering if it is possible to *mimic* the right click > save target as using PHP code.

The link is: http://www.site.com/somewhere/file.asp

Once you click on that URL with firefox it goes to download the file.

Can anyone tell me how to do this?
jim.thornton is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How can I parse this file?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23645 seconds with 12 queries