views:

86

answers:

1

I know it is easy to display a counter on a webpage but I need to implement the same, ie, I need to write data to a cell in the Excel 2007 spreadsheet every time a person downloads it from my webpage. To be more precise, when the user downloads the excel file to his hard drive and when it is opened, I want the spreadsheet to display the number of times the .xls file has been downloaded, in a cell (ofcourse along with other cells containing data).

I just need to figure out how do i programmmatically communicate with Excel 07 sheet.

+1  A: 

That sounds like an exercise in futility since the number will be out of date as soon as the next person downloads the file. Is this what you really want to do?

If yes, it's very possible using some server-side scripts. PHP, Perl and other languages all have libraries that can be used to edit Excel files programmatically. Pick the one you are most comfortable with and go from there.

EDIT:

I think the best way to go since you control both the Excel file and the website is to add a counter to the website, and reference it in your Excel file via web queries. If you're not familiar with web queries, they are a tool in excel that let you import tables from the web that will be refreshed everytime the file loads (or even if a user hits refresh). Here's more information about the Web Query Tool.

Let me know if this solution works for you.

EDIT2:

Here's a link to a more up-to-date tutorial.

Zenshai
Oh yeah, I didnt think of that,lolbut I could render the spreadsheet to be opened in a webpage in the browser instead of the user having it saved on his HD and have the cell containing the counter to be incremented through script.
Zaki