Save it as CSV. Here's a class I have for parsing CSV files. Change the write_line function to insert your SQL
<?
class CsvData {
var $headers;
var $fieldnum;
var $pwd;
function CsvData($infile, $pwd) {
$this->pwd = $pwd."/"; /* Change to \\ for Windozw */
if(empty($infile)) {
die("Error: You must specify file to read<br>");
}
if(!ereg("^/.*", $infile)){
$infile = $this->pwd.$infile;
}
if(!file_exists($infile)){
die("Error: ".$infile." does not exist!<br>");
}
$this->infile = $infile;
$this->fieldnum = $field;
$this->createFile=0;
return(true);
}
function get_column($num, $conn) {
$this->fieldnum = $num;
$this->fd=fopen($this->infile, "r") or die("Couldn't open file (".$file.")");
$count=0;
while($data = fgetcsv($this->fd, 1000, ", ")) {
$array=array();
if(is_array($this->fieldnum)) {
foreach($this->fieldnum as $num) {
$array[]=$data[$num];
}
}
else {
$array = array($data[$this->fieldnum]);
}
$this->write_line($array, $conn);
}
fclose($this->fd);
}
function write_line($data) {
mysql_query(/* INSERT STATEMENT HERE (INSERT INTO TABLE VALUES ('".$data[0]."','$data[1], so forth */
}
}
/* Now make the connection to your database, and call the class
Using $readCsv->get_column(array(0,1));, you specify which
columns you want to read from the CSV. */
$db = "";
$conn = mysql_connect("","","");
mysql_select_db($db, $conn);
$readCsv=new CsvData("Yourfile.csv", "/path/to/your/file");
$readCsv->get_column(array(0,1));
?>
HTH