# Working with Tables

After saving the template, we proceed to work with tables.

<figure><img src="https://sherparpa.ru/wp-content/uploads/2023/11/image13-203w366h.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3212714295-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI0zUnKkOuy6lWt7DZ46u%2Fuploads%2Fgit-blob-0e84d8165a65f7de7ef0a40a1c2c8c02257ee1d4%2F%D0%98%D0%BC%D0%BF%D0%BE%D1%80%D1%82%D0%A2%D0%B0%D0%B1%D0%BB%D0%B8%D1%86%D0%94%D0%BE%D0%BA%D0%BC%D0%BD%D1%82%D0%A8%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD.png?alt=media" alt=""><figcaption></figcaption></figure>

In the left part of the main settings panel, select the "Tables" tab — click the "Import" button ![](https://sherparpa.ru/wp-content/uploads/2023/11/image120-24w22h.png).

We import all tables from the document; for this, in the appeared window "Do you want to import all tables from the document into the template?" select "Yes".

All tables of the template that were recognized will be displayed on the working panel on the right. There may be one, two, or more. In our case, in the screenshot below, we see that the OCR module recognized 3 tables of the template.

<figure><img src="https://sherparpa.ru/wp-content/uploads/2023/11/image15-605w322h.png" alt=""><figcaption></figcaption></figure>

Each table is automatically assigned a number, starting from 0. The number of columns in each recognized table is also displayed. It is based on this value that we can determine which (or which) tables we will continue to work with.

In our example, we are interested in data from the table with 6 columns; therefore, we can delete the other tables (with 2 and 1 columns) from the panel window.

<figure><img src="https://sherparpa.ru/wp-content/uploads/2023/11/image17-284w86h.png" alt=""><figcaption></figcaption></figure>

To delete a table, click on the icon ![](https://sherparpa.ru/wp-content/uploads/2023/11/image63-1.png) on the top panel of the window, after selecting the table that needs to be deleted.

**Index**

OCR table index. If the Template Generator extracts data from only one table of the scanned document, the index must be set to 0. To improve binding, it is recommended to specify the minimum number of columns.

<figure><img src="https://sherparpa.ru/wp-content/uploads/2023/11/image18-311w161h.png" alt=""><figcaption></figcaption></figure>

**Minimum Number of Columns**

Specify the minimum number of columns in the OCR table. All tables with a number less than the specified will be skipped.

**Maximum Number of Columns**

Specify the maximum number of columns in the OCR table. All tables with a number greater than the specified will be skipped.

<figure><img src="https://sherparpa.ru/wp-content/uploads/2023/11/image19-296w150h.png" alt=""><figcaption></figcaption></figure>

When creating the template "Cost Report for Completed Work and Expenses," we specify a minimum number of columns equal to 5, as we are interested in data from the table with 6 columns. The other tables in this document contain fewer than 5 columns.

Thus, the Template Generator will continue to work with the table of interest to us.

When creating templates for other types of documents (with a larger number of tables and columns in the tables), both maximum and minimum numbers of columns can be specified, thereby setting the range within which tables with the data we are interested in will fall.

**Check**

To verify the correctness of the displayed table part from which the data will be imported, click the "Check" button on the top working panel.

<figure><img src="https://sherparpa.ru/wp-content/uploads/2023/11/image20-605w322h-2.png" alt=""><figcaption></figcaption></figure>

You can also start the check by pressing the F5 key.

**Skip Rows**

Specify the number of rows to skip so that the data from these rows does not get into the robot's results.

When selecting a value of 1, the first rows will be skipped. The column names will correspond to the values of the first row.

If column names are specified in the template, these values will not be changed.

In our example, we need to skip the top 5 rows of the table, as the values of the data we are interested in are indicated in the document table starting from row 6.

For this, in the "Skip Rows" field, we specify the number 5.

<figure><img src="https://sherparpa.ru/wp-content/uploads/2023/11/image21-261w148h.png" alt=""><figcaption></figcaption></figure>

**Rows in Header**

When building the table, the specified number of rows will be used to create the column headers. When specifying a value of 0, the headers will be taken from the column template; otherwise, the name will be summed from the cells of the column according to the specified number of rows.

For example, in the template "Cost Report for Completed Work and Expenses," it is necessary to specify the number of header rows equal to 2, as the header should include information placed in the top two rows of the table.

<figure><img src="https://sherparpa.ru/wp-content/uploads/2023/11/image22-605w322h.png" alt=""><figcaption></figcaption></figure>

After performing the actions, it is necessary to check the intermediate result. Click "Check" — then "Perform Full Scan."

**Result of Full Scan**

The result of the full scan will be displayed as a table with imported data from the tabular part of the scanned document.

<figure><img src="https://sherparpa.ru/wp-content/uploads/2023/11/image23-544w290h.png" alt=""><figcaption></figcaption></figure>

**Define Columns**

At this stage, some data may be displayed incorrectly; in particular, the column names may not match the values that were previously set in the project script "Define Columns.process" — in the "Properties Panel" settings — "Variables."

To correct the displayed results, it is necessary to return to the project script "Define Columns.process," match the variable values set in the "Properties Panel" settings, add the columns specified here, and define names for them.

<figure><img src="https://sherparpa.ru/wp-content/uploads/2023/11/image24-605w282h.png" alt=""><figcaption></figcaption></figure>

**Adding Columns "Quantity," "VAT Amount," "Rate."**

In our example, several columns are missing in the results of the full scan, including the "Quantity" column.

The column name must correspond to the value assigned to this variable "quantity."

![](https://sherparpa.ru/wp-content/uploads/2023/11/image25.png)

![](https://sherparpa.ru/wp-content/uploads/2023/11/image27-190w328h.png) ![](https://sherparpa.ru/wp-content/uploads/2023/11/image28-379w134h.png)

Adding the missing columns is done on the right working panel of the Template Generator in the "Tables" tab. Click the button ![](https://sherparpa.ru/wp-content/uploads/2023/11/image75-1.png), add a column, and assign the column the name "Quantity."

Upon rechecking, the "Quantity" column will appear in the results of the full scan of the Template Generator.

We check the other columns and adjust their names according to the variable values in the project script "Define Columns.process."

When creating the template "Cost Report for Completed Work and Expenses," we similarly add the columns: "VAT Amount," "Rate."

If the column name does not match the variable name, but the content of the column corresponds to the value of the variable, then it is not necessary to create an additional column; it is sufficient to change the column name in the Template Generator.

![](https://sherparpa.ru/wp-content/uploads/2023/11/image29-271w289h.png) ![](https://sherparpa.ru/wp-content/uploads/2023/11/image30.png)

For example, in the table with the results of the Template Generator, the column name is "Cost at the Start of Work," while the variable name is "Price," so we change the column name, ensuring that this column indeed displays the price.

Similarly, it is necessary to change the names of all columns that do not match the variable names.

The numbering of columns in the Template Generator starts from 0.

<figure><img src="https://sherparpa.ru/wp-content/uploads/2023/11/image31-280w245h.png" alt=""><figcaption></figcaption></figure>

If the column name is saved by default and contains a numerical value (for example, "Unnamed1"), then in the results table of the Template Generator, the name of the specified column will be determined automatically and will contain text from the corresponding column of the scanned document.

If we manually changed the column name, then in the results table of the Template Generator, the specified column name will be displayed.

Therefore, we recommend paying special attention to the part of the tabular document where the column name is indicated in merged cells. Even if the column name from merged cells was recognized correctly when creating the document template, in other documents, the name may be indicated with a shift.

In our example, the word "Cost" is located in the 4th cell of the table, but in some documents, it may shift to the 5th cell. In such cases, we recommend renaming all cells whose names may be shifted.

<figure><img src="https://sherparpa.ru/wp-content/uploads/2023/11/image32.png" alt=""><figcaption></figcaption></figure>

Upon completing work with the table in the Template Generator, it is necessary to perform a check and ensure the correctness of the results of the full scan.
