【问题标题】:how to import the calculated values from cell in laravel / excelinstead of their formulas?如何从 laravel / excel 中的单元格导入计算值而不是它们的公式?
【发布时间】:2020-02-28 11:52:28
【问题描述】:

请给我一个简单而好的解决方案,用于在导入时导入单元格的计算值而不是它们的公式?

public function import()
{
    for ($i = 1; $i <=2 ; $i++) {
        $import = new SiteImport();
        $import->onlySheets('SiteImport');
        Excel::import($import, 'C:\Users\ahmad\OneDrive\Desktop\sites\site'.$i.'.xlsx');
    }

    return redirect('/site');
}

【问题讨论】:

    标签: php excel laravel maatwebsite-excel


    【解决方案1】:

    这个问题已经列在Maatwesite excel repo

    要获得公式的计算值,只需添加以下行

    use Maatwebsite\Excel\Concerns\WithCalculatedFormulas;
    

    【讨论】:

    • Allowed memory size of 1073741824 bytes exhausted (tried to allocate 50331656 bytes)
    • 你的代码一定有错误。尝试增加你的php.ini文件memory_limit = 2048M
    • @Ahmad 更新 php.ini 文件后你重启服务器了吗?
    • 允许的内存大小为 790626304 字节已用尽(尝试分配 4096 字节)
    • 允许的内存大小为 790626304 字节已用尽(尝试分配 4096 字节)
    猜你喜欢
    • 2015-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多