Update Bugs Fix Import

This commit is contained in:
2023-08-30 17:39:35 +07:00
parent a5dd6dfca3
commit d3fb049c97
4 changed files with 90 additions and 54 deletions

View File

@@ -64,22 +64,22 @@ class ImportService{
public function addArrayToRow($array, $sheetName = null)
{
// Switch to the correct Sheet Before Write
if ($sheetName) {
if ($sheetName != $this->writer->getCurrentSheet()->getName()) {
foreach ($this->writer->getSheetIterator() as $sheet) {
if ($sheet->getName() == $sheet) {
$this->writer->setCurrentSheet($sheet);
break;
// Switch to the correct Sheet Before Write
if ($sheetName) {
$currentSheet = $this->writer->getCurrentSheet();
if ($sheetName != $currentSheet->getName()) {
$sheets = $this->writer->getSheets();
foreach ($sheets as $sheet) {
if ($sheet->getName() == $sheetName) {
$this->writer->setCurrentSheet($sheet); // Set the correct sheet
break;
}
}
}
}
}
}
$newRow = $this->makeRow($array);
$this->writer->addRow($newRow);
return $this;
$newRow = $this->makeRow($array);
// $this->writer->addRow($newRow);
return $this;
}
}