<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>The Busy Pixel &#187; php</title>
	<atom:link href="http://www.thebusypixel.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thebusypixel.com</link>
	<description>If you look after truth and goodness, beauty looks after herself</description>
	<pubDate>Mon, 25 Aug 2008 23:45:39 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<item>
		<title>Reading Excel files with PHP</title>
		<link>http://www.thebusypixel.com/2008/05/07/reading-excel-files-with-php/</link>
		<comments>http://www.thebusypixel.com/2008/05/07/reading-excel-files-with-php/#comments</comments>
		<pubDate>Wed, 07 May 2008 23:56:56 +0000</pubDate>
		<dc:creator>bucky</dc:creator>
		
		<category><![CDATA[Found it on the interwebs!]]></category>

		<category><![CDATA[Web Devel Hints]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[web programming]]></category>

		<guid isPermaLink="false">http://www.thebusypixel.com/?p=588</guid>
		<description><![CDATA[Ok so I just spent the better part of a day trying to parse .xls files with php to create tables  in mysql from the spreadsheets. I tried a bunch of different classes, tried export them a .csv files, all with varying levels of success.
This might really only be an answer to my particular [...]]]></description>
			<content:encoded><![CDATA[<p>Ok so I just spent the better part of a day trying to parse .xls files with php to create tables  in mysql from the spreadsheets. I tried a bunch of different classes, tried export them a .csv files, all with varying levels of success.</p>
<p>This might really only be an answer to my particular problem and set of .xls files, but I had some .xls files with thousands of rows, and it worked successfully on them. I post this in the hopes maybe I can give someone else a little help. </p>
<p>How it works is it globs for a list of *.xls files, and then loops through reading each one, creating the table SQL and INSERT SQL and then writing that to a file. The table is named according to the .xls file name, and the columns are generated via the first row in the file. For any empty columns, it will create a column called emptyColumn(n). You can then take the generated sql file and import it into the db. Feel free to modify the script to directly connect to the db (which would allow you to use  <a href="http://php.net/mysql_real_escape_string">mysql_real_escape_string</a> instead of the poorer addslashes (unless you are connected to a db, PHP will cough in its pants if you try to use mysql_real_escape_string). </p>
<p>The reason I didn&#8217;t just use <a href="http://us.php.net/manual/en/function.fgetcsv.php">fgetcsv</a> is that when I exported the xls file as a csv from Excel, it wouldn&#8217;t output a consistent number of rows/columns. So while I might have 30 headers, as it went line by line in the csv file, it might vary from 28 to 30. Which would mean my insert statement would get all jacked up.</p>
<p>The zip file contains the sample import script (that I ran via command line with php 5.2.x), and the excel reader class I found online. Not the most elegant thing I&#8217;ve ever made, but hey, it works?</p>
<p><a href='http://www.thebusypixel.com/wp-content/uploads/2008/05/php_excel_sample.zip' title="PHP Excel to MySQL importer">PHP Excel to MySQL importer</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thebusypixel.com/2008/05/07/reading-excel-files-with-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>My latest project, a port of web.py to p &#8230;</title>
		<link>http://www.thebusypixel.com/2008/05/06/my-latest-project-a-port-of-webpy-to-p/</link>
		<comments>http://www.thebusypixel.com/2008/05/06/my-latest-project-a-port-of-webpy-to-p/#comments</comments>
		<pubDate>Tue, 06 May 2008 21:48:35 +0000</pubDate>
		<dc:creator>bucky</dc:creator>
		
		<category><![CDATA[ssdd]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[web development]]></category>

		<category><![CDATA[web.py]]></category>

		<guid isPermaLink="false">http://www.thebusypixel.com/2008/05/06/my-latest-project-a-port-of-webpy-to-p/</guid>
		<description><![CDATA[My latest project, a port of web.py to php:
web-php
feel free to download and break, hope people find it useful.
]]></description>
			<content:encoded><![CDATA[<p>My latest project, a port of web.py to php:</p>
<p><a href="http://code.google.com/p/webpy-php-port/">web-php</a></p>
<p>feel free to download and break, hope people find it useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thebusypixel.com/2008/05/06/my-latest-project-a-port-of-webpy-to-p/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
