• Published:October 6th, 2008
  • Comments:No Comment
  • Category:PHP, XML
  • Share / Bookmark

One of my current clients has an old FoxPro (old as in created in '97 and upgraded in '99) database application that the users can't stand.  It frequently crashes and it's all too easy to lose valuable data after a lengthy data entry session (just by clicking the sadly misnamed Save button).  We are porting them over to a LAMP-based web application.  One of the early tasks in this project is to analyze their existing database structure.  This application involves hundreds of FoxPro DBF files which are tables (data and schema) that reside in various child directories.  

My initial approach (following the KISS principle) was to inspect some of these files and see what's in 'em and how to get the schema out of 'em.  I downloaded a trial version of DBF Viewer 2000 and it's a fine tool.  I was able to view the data and the schema and, using SnagIt, I captured the text and pasted the values to an Excel spreadsheet.  But purely manual approach would take way too long for me.  Time to whip out a quick script.  The problem: .NET or PHP or other?  I'm a recovering .NET dev working on PHP apps.  I surprised myself by deciding to go for the PHP option.  And I'm glad I did.  Here's how I was able to create an Excel spreadsheet with hundreds of worksheets in PHP.

Would you like to know more?