diff --git a/project/npda/general_functions/csv/csv_upload.py b/project/npda/general_functions/csv/csv_upload.py index c01cc191..56644db1 100644 --- a/project/npda/general_functions/csv/csv_upload.py +++ b/project/npda/general_functions/csv/csv_upload.py @@ -293,6 +293,8 @@ async def validate_rows_in_parallel(rows_by_patient, async_client): except Exception as error: errors_to_return[visit_row_index]["__all__"].append(error) - # Copy csv to a styled xlsx. - _ = write_errors_to_xlsx(errors_to_return, new_submission) + # Only create xlsx file if the csv file was created. + if new_submission.csv_file: + _ = write_errors_to_xlsx(errors_to_return, new_submission) + return errors_to_return