[PHP] PhpSpreadsheet - Excel(엑셀) 제어 라이브러리

2020. 2. 25. 14:37개발자료/Web


반응형

# Documentation

https://phpspreadsheet.readthedocs.io/en/latest/

 

Welcome to PhpSpreadsheet's documentation - PhpSpreadsheet Documentation

Welcome to PhpSpreadsheet's documentation PhpSpreadsheet is a library written in pure PHP and providing a set of classes that allow you to read from and to write to different spreadsheet file formats, like Excel and LibreOffice Calc. File formats supported

phpspreadsheet.readthedocs.io

# Install

composer require phpoffice/phpspreadsheet

# 적용

require 'vendor/autoload.php';

 

# Composer 없이 자체 적용

아래 압축 파일을 해제 후 웹서버에 올린 후 사용하면 된다.

phpoffice_phpspreadsheet_1.10.1.0_require.zip
4.19MB

require $_SERVER['DOCUMENT_ROOT'] .'/phpoffice_phpspreadsheet_1.10.1.0_require/vendor/autoload.php'; 

 

 

# Xls 파일 읽기

use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Reader\Xls;
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls();
$spreadsheet = $reader->load($strFileFullPath);

 

# Sheet 가져오기

$sheet = $spreadsheet->getActiveSheet();

 

반응형