1. Set up a PHP program running environment to execute the program, as long as the program can run
2. Download PHPExcel. php class files and related components
3. Include it in the file to be run require PHPExcel.php, create the object by default Use excel2007 to read excel. If the format is incorrect, use the previous version to read
4. Read excel There can be multiple worksheets. If you only need to read the first one, use $PHPExcel->getSheet(0). If there are multiple worksheets, operate the other contents in a loop
5. Get the rows and columns of the excel table respectively
$allColumn = $currentSheet->getHighestColumn(); /**取得一共有多少行*/ $allRow = $currentSheet->getHighestRow(); /**从第二行开始输出,因为excel表中第一行为列名*/
6. Read the corresponding data in a double loop of rows and columns
for($currentRow = 2;$currentRow <= 98;$currentRow++){ /**从第A列开始输出*/ echo""; //for($currentColumn= 'A';$currentColumn<= $allColumn; $currentColumn++){ $cancername=""; for($currentColumn= 'A';$currentColumn<='B'; $currentColumn++){ Copy after loginTwo for cross-positioning can read the cell data
Recommended tutorial: PHP video tutorial
The above is the detailed content of How to read data in excel in php. For more information, please follow other related articles on the PHP Chinese website!
Previous article:How to open a word document in php and get the content inside Next article:How to get the current date in phpStatement of this WebsiteThe content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]Latest Articles by Author
2024-06-24 00:25:30 2024-06-24 00:12:50 2024-06-23 22:40:50 2024-06-23 22:03:42 2024-06-23 22:03:20 2024-06-23 21:57:39 2024-06-23 21:54:20 2024-06-23 21:49:12 2024-06-23 21:46:28 2024-06-23 21:44:30Latest IssuesPHP trim unicode spaces I'm trying to trim unicode spaces such as this character and I was able to do it using thi...From 2023-11-13 08:49:4502398Related TopicsMore>
Compare the similarities and differences between two columns of data in excel
excel duplicate item filter color
How to copy an Excel table to make it the same size as the original
Excel table slash divided into two
Excel diagonal header is divided into two
Absolute reference input method
java export excel
Excel input value is illegal
- About us Disclaimer Sitemap
- php.cn:Public welfare online PHP training,Help PHP learners grow quickly!