承接 tiempor3al/excelreader 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tiempor3al/excelreader

Composer 安装命令:

composer require tiempor3al/excelreader

包简介

Simple and fast Excel .xlsx parser

README 文档

README

ExcelReader is a very simple and fast Excel (.xlsx) parser with no third-party dependencies.

<?php

require __DIR__ . '/vendor/autoload.php';

use tiempor3al\Excel\Reader as ExcelReader;

if(!isset($argv[1])){
    die("Missing Excel filename...");    
}

$reader = new ExcelReader();
$reader->Initialize($argv[1]);
$worksheets = $reader->getWorksheets();

//We parse the first worksheet and the first two columns
$generator = $reader->ParseWorksheet($worksheets[0], ['A:B']);

//Since the library uses generators, it consumes little memory
foreach ($generator as $cell) {
   
    if ($cell === ExcelReader::START_ROW) {
        //Do initialization stuff here
        printf("Start of row...\r\n");
    }

    //if cell is an array then we get its value
    if (is_array($cell)) {

        //$cell holds four values:
        //'cell' => A8 - the position of the cell
        //'row' => 8 - the row of the cell
        //'col' => A - the column of the cell
        //'value' => xyz - the value of the cell
        

        //For values like strings and numbers, we can get the value in $cell['value']
        if ($cell['col'] == 'A') {
            printf("Cell value: %s\r\n",$cell['value']);
        }
        
        //For dates we need to convert the values using the toDate method
        //Suppose that column B is filled with dates
        if ($cell['col'] == 'B') {
            //toDate returns a DateTime Object
            $date = $reader->toDate($cell['value']);
            
            printf("Cell value: %s\r\n",$date->format('Y-m-d'));
        }
    }

    if ($cell === ExcelReader::END_ROW) {
    	printf("End of row...\r\n");
    }
}

统计信息

  • 总下载量: 19
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-12-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固