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"<tr>"; //for($currentColumn= 'A';$currentColumn<= $allColumn; $currentColumn++){ $cancername=""; for($currentColumn= 'A';$currentColumn<='B'; $currentColumn++){
Two 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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Chinese version
Chinese version, very easy to use

WebStorm Mac version
Useful JavaScript development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver Mac version
Visual web development tools
