diff --git a/textractor/entities/document.py b/textractor/entities/document.py index 728670b..ba69c22 100644 --- a/textractor/entities/document.py +++ b/textractor/entities/document.py @@ -569,6 +569,7 @@ def export_kv_to_csv( include_kv: bool = True, include_checkboxes: bool = True, filepath: str = "Key-Values.csv", + sep: str = ";", ): """ Export key-value entities and checkboxes in csv format. @@ -579,6 +580,8 @@ def export_kv_to_csv( :type include_checkboxes: bool :param filepath: Path to where file is to be stored. :type filepath: str + :param sep: Separator to be used in the csv file. + :type sep: str """ keys = [] values = [] @@ -597,9 +600,9 @@ def export_kv_to_csv( values.append(kv.value.children[0].status.name) with open(filepath, "w") as f: - f.write(f"Key;Value{os.linesep}") + f.write(f"Key{sep}Value{os.linesep}") for k, v in zip(keys, values): - f.write(f"{k};{v}{os.linesep}") + f.write(f"{k}{sep}{v}{os.linesep}") logging.info( f"csv file stored at location {os.path.join(os.getcwd(),filepath)}"