How to parse table without borders
Step by step guide:
This guide is made for borderless table. The template in this tutorial is based on the table image below. You can get the template here.
First, create a new Document Parser template using the Online Template Editor.
Next, click the Load Test PDF or Image button and select your source file.
Then, click the +Add Objects button.
Select Add TABLE field based on TEXT SEARCH.
Click on the Edit Template button and look for the table object.
Replace the tableProperties with the following:
"tableProperties": {
"start": {
"expression": "Product Code{{Spaces}}Item Name",
"regex": true
},
"end": {
"expression": "Total",
"regex": true
},
"row": {
"expression": "{{LineStart}}{{Spaces}}(?<code>{{UppercaseLettersOrDigits}}){{Spaces}}(?<item>{{SentenceWithSingleSpaces}}){{Spaces}}(?<options>{{SentenceWithSingleSpaces}}){{Spaces}}(?<qty>{{Number}}){{Spaces}}{{Dollar}}(?<price>{{Number}}){{Spaces}}{{Dollar}}(?<subtotal>{{Number}})",
"subExpression1": "{{LineStart}}{{Spaces}}(?<item>{{SentenceWithSingleSpaces}}){{Spaces}}(?<options>{{SentenceWithSingleSpaces}}{{LineEnd}})",
"subExpression2": "{{LineStart}}{{Spaces}}(?<options>{{SentenceWithSingleSpaces}}{{LineEnd}})",
"regex": true
},
"columns": [
{
"name": "code",
"dataType": "string"
},
{
"name": "item",
"dataType": "string"
},
{
"name": "options",
"dataType": "string"
},
{
"name": "qty",
"dataType": "integer"
},
{
"name": "price",
"dataType": "decimal"
},
{
"name": "subtotal",
"dataType": "decimal"
}
],
"multipage": true
}
- Run the template and output will look like below.