Install
Works with Drupal: ^8 || ^9Using Composer to manage Drupal site dependencies
Alternative installation files
Download tar.gz
27.59 KB
MD5: edc882b6646b4c40bf3a2fa8007232bb
SHA-1: aa99847eb5d7e78ce33e4ca7d720df9cc923d28f
SHA-256: a9477678f4b5d57acf5d0f7846f4b896b42541aeec21fbd298987e219f35e0e0
Download zip
39.52 KB
MD5: 241e7ae1bcca11071c2e7d420592927e
SHA-1: c137ba475858c8af228047aef56621749f8b4f21
SHA-256: 56bf622e237ab58171e8d1261be25e7466a4e2ce584530eadf112e5ebac7f7db
Release notes
Services.
Import data from an Excel file.
$phpexcel = \Drupal::service('phpexcel');
$filepath = 'modules/contrib/phpexcel/tests/Functional/data/phpexcel.test.multi_sheet.xlsx';
$result = $phpexcel->import($filepath);
print_r($result);
Export data as an Excel file.
$headers = ['Header 1', 'Header 2'];
$data = [
['Data 1.1', 'Data 1.2'],
['Data 2.1', 'Data 2.2'],
['Data 3.1', 'Data 3.2'],
];
$phpexcel = \Drupal::service('phpexcel');
$filepath = 'sites/default/files/test.xlsx';
$result = $phpexcel->export($headers, $data, $filepath);
print_r($result);