Answer the question
In order to leave comments, you need to log in
How to format date with maatwebsite/excel in Laravel?
Good afternoon everyone!
Problem: There is an Excel document, one of the columns of which is a date in an unknown format.
It is necessary to organize data import using the maatwebsite/excel package.
Now , if the date in the column is given in the format dd.MM.yyyy - maatwebsite/excel turns the values (dates) into numbers, for example: 23563.0.
In the documentation, this problem is solved by explicitly specifying the date format: the date format in the document may vary. Tell me , please, how can I organize automatic date formatting from X format to Y format using maatwebsite / excel in Laravel?$reader->formatDates(true, 'Y-m-d');
$reader->filter('chunk')
->load($this->getImportFile())
->chunk(200, function($rowCollection) {
$rows = $rowCollection->all();
dd($rows);
});
Answer the question
In order to leave comments, you need to log in
The answer is simple - do not use automatic import.
Process the fields yourself, create an array with import rules for each field. Thus, you can customize at least the filling of complex links.
So it will be much more universal, believe me.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question