Excel Diff API
Usage
POST https://api.diffchecker.com/public/excel
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
input_type | string | query | Specifies the request content-type. Value must be one of 'json' or 'form' | |
diff_level | string | query | Specifies whether you want to diff values by their formulas or standard values. Value must be one of 'formulas' or 'standard'. Default is 'standard'. | |
ignore_whitespace | string | query | Specifies whether you want to ignore whitespace (leading and trailing spaces) in the diff. Value must be one of 'true' or 'false'. Default is 'false'. | |
ignore_case_changes | string | query | Specifies whether you want to ignore case changes in the diff. Value must be one of 'true' or 'false'. Default is 'false'. | |
hide_unchanged_rows | string | query | Specifies whether you want to hide unchanged rows in the diff. Value must be one of 'true' or 'false'. Default is 'false'. | |
hide_unchanged_columns | string | query | Specifies whether you want to hide unchanged columns in the diff. Value must be one of 'true' or 'false'. Default is 'false'. | |
left_spreadsheet | file or string | body | If input_type=json: string containing data URL of the left spreadsheet you want to diff If input_type=form: Left spreadsheet file you want to diff. File extension must be .xlsx, .xls, or .csv | |
right_spreadsheet | file or string | body | If input_type=json: string containing data URL of the right spreadsheet you want to diff If input_type=form: Right spreadsheet file you want to diff. File extension must be .xlsx, .xls, or .csv | |
left_sheet_name | string | body | The sheet name from the left spreadsheet you want to diff. If not provided, the first sheet will be used. | |
right_sheet_name | string | body | The sheet name from the right spreadsheet you want to diff. If not provided, the first sheet will be used. | |
left_header_row | number | body | The row number that you want to use as the header from the left spreadsheet you want to diff. If not provided, the first row will be used. | |
right_header_row | number | body | The row number that you want to use as the header from the right spreadsheet you want to diff. If not provided, the first row will be used. |
Example Request
curl --location --request POST 'https://api.diffchecker.com/public/excel?input_type=form&email=YOUR_EMAIL' \ --form 'left_spreadsheet=@"/Users/user_name/Documents/example-1.xlsx"' \ --form 'right_spreadsheet=@"/Users/user_name/Documents/example-2.xlsx"'
Output
Example Output
{ "table": [ [ [ { "value": "Bird", "type": "equal" } ], [ { "value": "Population", "type": "equal" } ] ], [ [ { "value": "Kagu", "type": "equal" } ], [ { "value": "1,000", "type": "equal" } ] ], [ [ { "value": "Dodo", "type": "removed" } ], [ { "value": "0", "type": "removed" } ] ], [ [ { "value": "Kiwi", "type": "equal" } ], [ { "value": "120,000", "type": "removed" }, { "value": "70,000", "type": "inserted" } ] ] ], "rows": [ { "type": "equal", "original": 1, "new": 1 }, { "type": "equal", "original": 2, "new": 2 }, { "type": "removed", "original": 3, "new": null }, { "type": "modified", "original": 4, "new": 3 } ], "columns": [ { "type": "equal", "original": 1, "new": 1 }, { "type": "modified", "original": 2, "new": 2 } ], "stats": { "moved": 0, "inserted": 1, "removed": 2, "rows": 4, "columns": 2 } }
Here is a visualization of the example output. The Kagu population remained the same, the Dodo was removed because it is extinct, and the Kiwi population declined.
1 | 1 | Bird | Population |
---|---|---|---|
2 | 2 | Kagu | 1,000 |
3 | Dodo | 0 | |
4 | 3 | Kiwi | 120,00070,000 |
Explanation
{ "rows": [ { "type": "equal", "original": 1, "new": 1 }, { "type": "equal", "original": 2, "new": 2 }, { "type": "removed", "original": 3, "new": null }, { "type": "modified", "original": 4, "new": 3 } ] }
Rows
The rows contain the original row number, the new row number, and the type of change that occurred to the row.
original: The row number in the left or original spreadsheet.
new: The row number in the right or new spreadsheet.
type: The type of change that occurred to the row.
In our example, the first two rows are the same, the third row was removed, and the fourth row was modified. The fourth row shifted up from row 4 to 3 because the row above it was removed.
{ "columns": [ { "type": "equal", "original": 1, "new": 1 }, { "type": "modified", "original": 2, "new": 2 } ] }
Columns
Same as the rows, the columns contain the original column number, the new column number, and the type of change that occurred to the column.
original: The column number in the left or original spreadsheet.
new: The column number in the right or new spreadsheet.
type: The type of change that occurred to the column.
In our example, the first column is the same. The second column was modified from the cell containing the Kiwi's old and new population.
{ "table": [ [ [ { "value": "Bird", "type": "equal" } ], [ { "value": "Population", "type": "equal" } ] ], [ [ { "value": "Kagu", "type": "equal" } ], [ { "value": "1,000", "type": "equal" } ] ], [ [ { "value": "Dodo", "type": "removed" } ], [ { "value": "0", "type": "removed" } ] ], [ [ { "value": "Kiwi", "type": "equal" } ], [ { "value": "120,000", "type": "removed" }, { "value": "70,000", "type": "inserted" } ] ] ] }
Table
The table contains the diff results for each cell. Cells are organized by rows, with each row containing cells in column order (left to right). Each cell is represented by an array nesting one object, or two if the value inside the cell was changed. The object contains the type of the cell and the value of the cell.
type: The change that occurred to its respective value.
value: The content of that change.
In our example, every cell is unchanged or equal, except for the cells that were removed with the Dodo's row and the cell containing the Kiwi's old and new population.
{ "stats": { "moved": 0, "inserted": 1, "removed": 2, "rows": 4, "columns": 2 } }
Stats
The stats object contains the number of rows, columns, and cells that were modified, inserted, or removed, as well as the total rows and columns of the output diffed spreadsheet.
In our example, there is one removal from the Dodo's row and one removal of the Kiwi's old population, with the corresponding insertion of the Kiwi's new population.