분류 php

스프레드 시트 파일을 읽고 쓰는 순수한 PHP 라이브러리

컨텐츠 정보

  • 조회 305 (작성일 )

본문

PhpSpreadsheet는 순수 PHP로 작성되었으며 Excel 및 LibreOffice Calc와 같은 다른 스프레드 시트 파일 형식을 읽고 쓸 수 있는 클래스 세트를 제공하는 라이브러리입니다.


https://github.com/PHPOffice/PhpSpreadsheet 


지원되는 파일 형식 

FormatReadingWriting
Open Document Format/OASIS (.ods)
Office Open XML (.xlsx) Excel 2007 and above
BIFF 8 (.xls) Excel 97 and above
BIFF 5 (.xls) Excel 95
SpreadsheetML (.xml) Excel 2003
Gnumeric
HTML
SYLK
CSV
PDF (using either the TCPDF, Dompdf or mPDF libraries, which need to be installed separately)

소프트웨어 요구 사항 


PHP 버전 7.1 이상. PHP 확장과 같은 다른 요구 사항은 composer가 시행합니다. 

자세한 내용은 composer.json 파일의 require 섹션을 참조하십시오.


스프레드 시트를 작성하는 가장 간단한 방법입니다. 


<?php require 'vendor/autoload.php'; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); $sheet->setCellValue('A1', 'Hello World !'); $writer = new Xlsx($spreadsheet); $writer->save('hello world.xlsx');