LoginSignup
15
16

More than 5 years have passed since last update.

PHPExcelでxlsファイルをCSVに変換する

Posted at

PHPExcelというライブラリを使うと、xlsからcsvへかんたんに変換できます。

excel2csv.php
<?php

//PHPExcelライブラリ読み込み
require_once 'PHPExcel.php';
require_once 'PHPExcel/IOFactory.php';

//Excel読み込み
$objReader = PHPExcel_IOFactory::createReader('Excel5');
$book = $objReader->load('hodade.xls');

//CSV保存
$writer = PHPExcel_IOFactory::createWriter($book, 'csv');
$writer->save('hodade.csv');

以上!

PHPExcel
https://phpexcel.codeplex.com/

15
16
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
16