Cyber-Duck / laravel-excel

This package provides a way to export an Eloquent collection as an excel file and to import a Excel file as an Eloquent collection.
https://www.cyber-duck.co.uk
MIT License
74 stars 27 forks source link

Sum up specific cell range #10

Open guevarawebgraphics opened 4 years ago

guevarawebgraphics commented 4 years ago

Currently I can get the data from my excel file, for every sheet I can get the data collection. The problem is, I want to sum up the value of specific cell range.

For example, I have field of weight and I want to get the grand total of that field.

My question in stackoverflow: https://stackoverflow.com/questions/59081560/cyberduck-sum-up-column-value-laravel-excel

SimoTod commented 4 years ago

Once you get the collection object, you can use one of the standard laravel methods to calculate the total. It looks like you need to use "reduce". (https://laravel.com/docs/5.8/collections#method-reduce)