Laravel Excel:如何获得细胞的价值? [英] Laravel Excel: how to get value of a cell?

查看:86
本文介绍了Laravel Excel:如何获得细胞的价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用 Laravel Excel 加载了.xls文件:

I've loaded .xls file with Laravel Excel:

Excel::load('public/files/20160621.xls', function($reader) {
    // read a cell value
});

如何读取已加载的excel文件的单元格值?该部分的文档似乎还不清楚.

How do I read values of cells of the loaded excel file? Documentation seems to be unclear on that part.

推荐答案

public function get()
{
    $excelFile ...
    return Excel::load($excelFile, function($doc) {

        $sheet = $doc->getSheetByName('data'); // sheet with name data, but you can also use sheet indexes.

        $sheet->getCell('A1');
        $sheet->getCellByColumnAndRow(0,0);           

    });
}

是的,尚不清楚读取某些单元格的文档. 希望对您有帮助.

You're right, the documentation to read some cells is unclear. Hope this will help you.

这篇关于Laravel Excel:如何获得细胞的价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆