1<?php
2
3error_reporting(E_ALL);
4set_time_limit(0);
5
6date_default_timezone_set('Europe/London');
7
8?>
9<html>
10<head>
11<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
12
13<title>PHPExcel Reading WorkBook Data Example #01</title>
14
15</head>
16<body>
17
18<h1>PHPExcel Reading WorkBook Data Example #01</h1>
19<h2>Read the WorkBook Properties</h2>
20<?php
21
22/** Include path **/
23set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
24
25/** PHPExcel_IOFactory */
26include 'PHPExcel/IOFactory.php';
27
28
29$inputFileType = 'Excel5';
30$inputFileName = './sampleData/example1.xls';
31
32/**  Create a new Reader of the type defined in $inputFileType  **/
33$objReader = PHPExcel_IOFactory::createReader($inputFileType);
34/**  Load $inputFileName to a PHPExcel Object  **/
35$objPHPExcel = $objReader->load($inputFileName);
36
37
38echo '<hr />';
39
40/**  Read the document's creator property  **/
41$creator = $objPHPExcel->getProperties()->getCreator();
42echo '<b>Document Creator: </b>',$creator,'<br />';
43
44/**  Read the Date when the workbook was created (as a PHP timestamp value)  **/
45$creationDatestamp = $objPHPExcel->getProperties()->getCreated();
46/**  Format the date and time using the standard PHP date() function  **/
47$creationDate = date('l, d<\s\up>S</\s\up> F Y',$creationDatestamp);
48$creationTime = date('g:i A',$creationDatestamp);
49echo '<b>Created On: </b>',$creationDate,' at ',$creationTime,'<br />';
50
51/**  Read the name of the last person to modify this workbook  **/
52$modifiedBy = $objPHPExcel->getProperties()->getLastModifiedBy();
53echo '<b>Last Modified By: </b>',$modifiedBy,'<br />';
54
55/**  Read the Date when the workbook was last modified (as a PHP timestamp value)  **/
56$modifiedDatestamp = $objPHPExcel->getProperties()->getModified();
57/**  Format the date and time using the standard PHP date() function  **/
58$modifiedDate = date('l, d<\s\up>S</\s\up> F Y',$modifiedDatestamp);
59$modifiedTime = date('g:i A',$modifiedDatestamp);
60echo '<b>Last Modified On: </b>',$modifiedDate,' at ',$modifiedTime,'<br />';
61
62/**  Read the workbook title property  **/
63$workbookTitle = $objPHPExcel->getProperties()->getTitle();
64echo '<b>Title: </b>',$workbookTitle,'<br />';
65
66/**  Read the workbook description property  **/
67$description = $objPHPExcel->getProperties()->getDescription();
68echo '<b>Description: </b>',$description,'<br />';
69
70/**  Read the workbook subject property  **/
71$subject = $objPHPExcel->getProperties()->getSubject();
72echo '<b>Subject: </b>',$subject,'<br />';
73
74/**  Read the workbook keywords property  **/
75$keywords = $objPHPExcel->getProperties()->getKeywords();
76echo '<b>Keywords: </b>',$keywords,'<br />';
77
78/**  Read the workbook category property  **/
79$category = $objPHPExcel->getProperties()->getCategory();
80echo '<b>Category: </b>',$category,'<br />';
81
82/**  Read the workbook company property  **/
83$company = $objPHPExcel->getProperties()->getCompany();
84echo '<b>Company: </b>',$company,'<br />';
85
86/**  Read the workbook manager property  **/
87$manager = $objPHPExcel->getProperties()->getManager();
88echo '<b>Manager: </b>',$manager,'<br />';
89
90
91?>
92<body>
93</html>
94