diff --git a/src/core/excelreader.cpp b/src/core/excelreader.cpp index 7ef401d..7c6abe2 100644 --- a/src/core/excelreader.cpp +++ b/src/core/excelreader.cpp @@ -22,20 +22,14 @@ std::size_t ExcelReader::readSellersFromFile(const fs::path& filePath, Marketpla market->storeToDb(true); auto ws = wb.sheet_by_index(0); - const int START_ROW = 5; - const int END_ROW = 504; - - int rowCount{}; - for (const auto& row : ws.rows(false)) { - if (rowCount < START_ROW) { - ++rowCount; + for (auto row : ws.rows(true)) { + // Skip the row if the first value is not a number (= seller no) + if (row[0].data_type() != xlnt::cell::type::number) { continue; - } else if (rowCount > END_ROW) { - break; } + //Skip the row if the seller has neither a first name nor a surname if (row[2].value().empty() && row[3].value().empty()) { - ++rowCount; continue; } auto seller = std::make_unique(); @@ -46,7 +40,6 @@ std::size_t ExcelReader::readSellersFromFile(const fs::path& filePath, Marketpla std::string lastName = row[3].value(); seller->setLastName(trim(lastName)); market->getSellers().push_back(std::move(seller)); - rowCount++; } // If there was no special seller "Sonderkonto" in import data, then create one