I guess if you are asking this question you have no choice, still I wonder whether it's sane to generate online images by updating an Excel worksheet and then extracting images from it. I'm saying this because on a job I had somebody had this devious idea of composing letters by automating (via OLE) MS-Word document compositions. This idea proved awful, because:
- It was quite slow (but we can forgive this)
- It often broke with no apparent reason
- It was unable to cope with moderate-to-heavy concurrency
MS-Office programs were designed to be invocated and used by humans, so are not really fit as server-side components. If you have a choice, I believe you should investigate graphic creation modules (like GD) that are much more suit to the task.
Please note: I'm not saying you should not automate via Excel, just that it does not seem very fit to me for serving images through a (busy) web server.
About your question, I'd create the file and store it within a table with a key that's related to its information and a timestamp. If - to say - we are talking about stock data, I'd store a key like "XXX-60" to mean it's the stock symbol XXX and the graph is for 60 days. Then I'd store the blob with your GIF and a timestamp. On loading, I'd query the database for a "XXX-60" created within the last five minutes; if not found, I'd create it and replace the old version in the database. I would not go for "real" files; they're harder to keep track of, will fragment the file system, and you need a CGI with a database connection to serve the request in any case.