mppair command#
Commands for working with pairs of files.
mppair subcommands are executed as part of a pipeline, where the output of one
command feeds the input of the next command, similar to how a pipe on unix works.
Example#
$ mppair -n "DCDate" -i left.xlsx right.xlsx conform -i replace -r "c" -v "b" replace -r "CDR[MZ]" -v CDR --regex compare
Breaking down the command:
mppair -n "DCDate" -iwill drop/ignore the DCDate columnleft.xlsx right.xlsxis the file pair to processconform -iwill conform the files to each other so that the column headers are similarly orderedreplace -r "c" -v "b"takes the resulting output file pair of the precedingconformcommand and replaces all cells with a value of “c” to “b”replace -r "CDR[MZ]" -v CDR --regextakes the result file pair of the precedingreplacecommand and replaces more values using a regular expressioncomparecompares the final results
mppair compare#
This command compares two Excel files and outputs differences found, if any.
If specific sheets to compare are not specified in the options (e.g. using
compare --sheet or compare --sheet-pair), then the default
is to compare common sheets (i.e. sheets with the same name.) If there are no
common sheets, then just compare the first sheets.
Usage#
$ mppair [OPTIONS] LEFT_FILE RIGHT_FILE compare [OPTIONS]
Options#
- -s <STRING>, --sheet=<STRING>#
Name of worksheet to compare in both files. If worksheet names are different, then use the
compare --sheet-pairoption below.
- -p <STRING>, --sheet-pair=(<STRING>,<STRING>)#
A length-2 tuple where the first and second strings are the names of the worksheets to be compared in the first and second Excel files, respectively. If the worksheet names are the same, you may use the
compare --sheetoption above.
- -c <STRING>, --sort-col=<STRING>#
Column to sort on before comparing. Should exist in both files.
- -e <STRING>, --engines=<STRING> (pandas|tablib)#
Which comparison engine to use.
pandas: compare using pandas DataFramestablib: compare using tablib Datasets
Arguments#
- LEFT_FILE#
Required. Filename/path of the first Excel file to compare.
- RIGHT_FILE#
Required. Filename/path of the other Excel file to compared with the first.
Output#
If differences are found, an Excel file is output showing the differences, one worksheet for each worksheet pair comparison.
Examples#
To compare all common sheets between the two files:
$ macpie file1.xlsx file2.xlsx compare
To compare sheet
CDRin left file with sheetCDRin right file:$ macpie --sheet CDR file1.xlsx file2.xlsx compare
To compare sheet
CDR_Ain left file with sheetCDR_Bin right file:$ macpie --sheet-pair CDR_A CDR_B file1.xlsx file2.xlsx compare
To compare sheet
CDRin left file with sheetCDRin right file, but first sorting by theInstrIDcolumn.$ macpie --sheet CDR --sort-col InstrID file1.xlsx file2.xlsx compare
API#
mppair compare#
Compare a pair of files and output the differences.
Example: | mppair -i col1 -i col2 file1.xlsx file2.xlsx compare
mppair compare [OPTIONS]
Options
- -e, --engines <engines>#