Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To validate data beyond the last row in Laravel Excel, you can use the chunk method instead of get to retrieve the data in chunks. This allows you to validate the data row by row until the end of the file is reached.

Here's an example:

Excel::filter('chunk')->load($path)->chunk(200, function ($results) {
    // Iterate over each row in the chunk and validate the data
    foreach ($results as $row) {
        // Validate the row data here
    }
});

In this example, the chunk method retrieves the data in chunks of 200 rows at a time. The foreach loop then iterates over each row in the chunk and applies the validation logic. This process continues until all rows have been validated, even if there are more rows than can be retrieved in a single chunk.