mirror of
https://github.com/qurator-spk/modstool.git
synced 2025-06-07 19:05:06 +02:00
✨ Optionally output to an Excel .xlsx file
This commit is contained in:
parent
0a9a66c2cc
commit
f9e418c460
2 changed files with 6 additions and 1 deletions
|
@ -451,7 +451,8 @@ def flatten(d: MutableMapping, parent='', separator='_'):
|
||||||
@click.option('--output', '-o', 'output_file', type=click.Path(), help='Output pickle file',
|
@click.option('--output', '-o', 'output_file', type=click.Path(), help='Output pickle file',
|
||||||
default='mods_info_df.pkl', show_default=True)
|
default='mods_info_df.pkl', show_default=True)
|
||||||
@click.option('--output-csv', type=click.Path(), help='Output CSV file')
|
@click.option('--output-csv', type=click.Path(), help='Output CSV file')
|
||||||
def process(mets_files: List[str], output_file: str, output_csv: str):
|
@click.option('--output-xlsx', type=click.Path(), help='Output Excel .xlsx file')
|
||||||
|
def process(mets_files: List[str], output_file: str, output_csv: str, output_xlsx: str):
|
||||||
"""
|
"""
|
||||||
A tool to convert the MODS metadata in INPUT to a pandas DataFrame.
|
A tool to convert the MODS metadata in INPUT to a pandas DataFrame.
|
||||||
|
|
||||||
|
@ -521,6 +522,9 @@ def process(mets_files: List[str], output_file: str, output_csv: str):
|
||||||
if output_csv:
|
if output_csv:
|
||||||
logging.info('Writing CSV to {}'.format(output_csv))
|
logging.info('Writing CSV to {}'.format(output_csv))
|
||||||
mods_info_df.to_csv(output_csv)
|
mods_info_df.to_csv(output_csv)
|
||||||
|
if output_xlsx:
|
||||||
|
logging.info('Writing Excel .xlsx to {}'.format(output_xlsx))
|
||||||
|
mods_info_df.to_excel(output_xlsx)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
@ -2,3 +2,4 @@ click
|
||||||
pandas
|
pandas
|
||||||
tqdm
|
tqdm
|
||||||
lxml
|
lxml
|
||||||
|
openpyxl
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue