In this article we’ll see how Parseur can help you extract tables from emails.
In fact, extracting tables from emails can be very useful, for example, when you want to process invoices coming in your mailbox.
Each invoice will have a varying number of items. Each item typically has a quantity, a label, and a price.
This article will assume you already have a Parseur account. If not, you can sign up for free here. Also, we will assume you already know how to create templates to parse simple emails with Parseur. If not, we recommend you to first read this Getting Started with Parseur article.
List parsing or Table parsing?
Parseur can parse two forms of repetitive text: Lists and Tables.
If you want to know more about list parsing, take a look a this article just here: How to parse repetitive blocks of text in emails?
Extracting a table from your emails, automatically
A table is comprised of a header and a body. The header is usually on top, in a vertical table, but can also be on the left, in an horizontal table.
A Table has repeating rows and rows are split by columns.
The example below shows a simple vertical table.
Here is what you get after processing this email in Parseur:
|Items.Description||Rainbow magic wand|
|Items.Description||Black pointy hat|
|Items.Description||Large orange pumpkin|
|DeliveryDate||November 1st, 2018|
How to extract tables from emails with Parseur?
Staying true with our philosophy, capturing a table in Parseur is as simple as point and click.
1. In the template editor select the whole table you want to capture.
2. Create a new Field like you would do for any normal field.
3. Click on the Edit button right of the field to bring up the field option panel.
4. Change the the format to Table (depending on your use case).
5. Adjust options as required:
- Pick a layout (HTML or Text, Vertical or Horizontal). Vertical HTML Table is the default.
- Optionally, you can also name your columns. If you don’t name your columns, tick “Table headers included in the selection“. Parseur wil then use the header’s content to name the columns.
- Optionally, if your table is more complex, you can fill in the row and cell separators with the pieces of text in the list that separates each item (regular expressions are supported). Leave blank to use Parseur’s built-in default separators (suitable in most cases). This can be tricky. Feel free to ask for our advice in the chat box. Or let us do the heavy lifting for you as part of our managed plans.
6. Click Update, add any other fields as required and save the template.
Connect to Zapier
There are four ways to send table data to Zapier:
- Send each document as a whole with all tables and lists flattened. Flattened means each document looks like the table mode result on the right of your document. It also means that the number of columns varies with the number of rows in the largest table (this is the default mode).
2. Send the table directly through Zapier, each row in this table will turn into a row (or item) in the target application (for example, a row in Google Spreadsheet). Non-table fields in the document are repeated for each row. Sub-tables, if any, are flattened.
These are the most commonly used options and should provide the best compatibility with other apps. If you have more advanced needs, read on!
3. Send the document with nested tables. This is similar to the JSON mode result on the right of your document. The number of columns does not vary with the number of rows. But the receiving app must be capable of handling item lists. At the time of this writing, very few apps handle list items, Freshbooks being an important exception.
4. Send the table directly through Zapier. Each row in this table will turn into a row (or item) in the target application (for example, a row in Google Spreadsheet). Non-table fields in the document are repeated for each row. This is similar to option 2, but the nested tables and lists if any, are not flattened.
As you can see, options 1 and 2 flatten the tables and are the safest, most compatible mode. If you encounter issues with on options 1 and 2, give options 3 and 4 a try, but keep an eye on app compatibility.
That’s all, folks! Now, Parseur can process all emails, regardless of the number of items or rows in the tables.
Please note that this feature is quite new and can be improved further with your advice. Don’t hesitate to give us some feedback on the chat at the bottom right of this screen or via our contact form.