You need to create an Excel file from the array data. There is an array with the following structure
Region / TP / Branch / City
Grouping lines should be by city in the branch (i.e. click on the branch and all cities in this branch are shown) and by region.
Санкт-Петербург Санкт-Петербург, г. Красное Село Санкт-Петербург, г. Кронштадт Санкт-Петербург, г. Павловск + Санкт-Петербургский ф-л + Северо-Западный Grouping by cities made. Click on the + lines of the line and open / close the city.
$i = 2; foreach ($structure as $region_key => $region_val) { foreach ($region_val as $tp_key => $tp_val) { foreach ($tp_val as $filial_key => $filial_val) { foreach ($filial_val as $city_key => $city_val) { $objPHPExcel->getActiveSheet()->getRowDimension($i)->setOutlineLevel(2); $objPHPExcel->getActiveSheet()->getRowDimension($i)->setVisible(true); $i++; } } } } I do not understand how to make grouping by region. For branches, I specify level 2, for region 1, but it does not work because it is necessary to group the levels in order, i.e. first level 1 and then level 2. But the fact is that I don’t know how many lines there will be in the region.