Skip to main content

Table Operations

🔗 Original page — Source of this material


Description

Tables are used to handle more complex data than ❗→ lists, for example, a catalog for an online store where each row contains different data: name, price, description, etc.

Note

The same action is used when working with Tables and with Google Sheets, but Google Sheets has a few unique actions that are covered in the article Operations with Google Sheets.

How do I add a Table to a project?

Info

Before you start, you need to create either a Table or a Google Sheet.

image-20200815-214108

How do I add an action to a project?

From the context menu, select Add actionTablesTable Operations

image-20200814-184112

Or use the ❗→ smart search.

What is this used for?

  • Working with sets of data
  • Adding and retrieving table elements
  • Deleting rows, columns, and duplicates
  • Linking to a file
  • Getting the number of rows and columns

How does the action work?

Note

You can specify the column number as either a number (starting from zero!) or, like in Excel, as an uppercase Latin letter!

Get column

Put the values of a specific column into a ❗→ list

image-20200814-190232

  1. Select the table you'll work with.
  2. Choose the function.
  3. Set the column or variable.
  4. The ❗→ list where all column values will be saved.
Example

Put all values from column B of ❗→ Table 1 into ❗→ List 1

image-20200814-191359

❗→ Table 1

Before processing

image-20200814-191010

After processing

image-20200814-191015

The values of the specified column are not deleted after processing

❗→ List 1

image-20200814-191239

Get rows

Get rows optionally deleting them from the table, and write them into a ❗→ list or ❗→ variables.

image-20200814-192818

  1. Select the table you'll work with.
  2. Choose the function.
  3. Row criteria (can use a variable): a) All b) Does not contain text c) Does not match a ❗→ regular expression d) First e) ❗→ By index (indexing from zero!) f) Random g) Contains text h) Matches a ❗→ regular expression
  4. Should the rows be deleted after processing?
  5. Save the result to a ❗→ list or variables.
Example

Take random rows from ❗→ Table 1 and put them into variables, deleting them after.

image-20200814-193546

❗→ Table 1

Before processing

image-20200814-193736

After processing

image-20200814-193830

Variables

image-20200814-194704

The variable *peremennay_3 is empty because the table only contains columns A and B

Add list

Put the values from a list into a specific column.

image-20200814-194954

  1. Select the table you'll work with.
  2. Choose the function.
  3. Set the column or variable.
  4. ❗→ List with the values.
Example

Take values from ❗→ List 1 and put them into column D of ❗→ Table 1

image-20200814-195131

❗→ List 1

image-20200814-195254

❗→ Table 1

Before processing

image-20200814-195341

After processing

image-20200814-200051

List values are not deleted

Add row

Add a row to the table.

image-20200814-200623

  1. Select the table you'll work with.
  2. Choose the function.
  3. Enter static text or a variable.
  4. Important note
Note

The row will be added to the end of the table

Tip

If you want to add several rows at once, use the Text Processing-to Table action.

Example

Add a custom text row to different columns.

image-20200814-200401

❗→ Table 1

Before processing

image-20200814-200750

After processing

image-20200814-201211

Write to cell

Add text to a specific cell.

image-20200814-201841

  1. Select the table you'll work with.
  2. Choose the function.
  3. Specify cell coordinates as static values or using ❗→ variables.
  4. Enter static text or a variable.
Example

Add text to a specific cell

image-20200814-202026

❗→ Table 1

Before processing

image-20200814-202516

After processing

image-20200814-202820

Rows are always added to the end of the table

Get number of columns

How many columns the table contains

image-20200814-202916

  1. Select the table you'll work with.
  2. Choose the function.
  3. Variable for the result.
Note

The variable will always contain only a numeric value

Example

Get the number of columns in ❗→ Table 1 and save to a variable

image-20200814-203017

Contents of ❗→ Table 1

image-20200814-203218

Result saved to variable *kolichestvo_strok

image-20200814-203321

Get number of rows

How many rows the table contains

image-20200814-203431

  1. Select the table you'll work with.
  2. Choose the function.
  3. Variable for the result.
Note

The variable will always contain only a numeric value

Example

Get the number of rows in ❗→ Table 1 and save to a variable

image-20200814-203759

Contents of ❗→ Table 1

image-20200814-203916

Result saved to variable *kolichestvo_strok

image-20200814-205216

Link the table to a file during project execution.

This action should be used when the file path is not known at template start but will be determined while the project runs.

image-20200814-205851

  1. Select the table you'll work with.
  2. Choose the function.
  3. Select the file or specify a variable containing the file path.
  4. If there’s no file at the specified path, Zennoposter will automatically create it.
Example

Link ❗→ Table 1 to a specific file

image-20200814-205718

❗→ Table 1 will be linked to the corresponding file

Read cell

Get the value from a specific cell

image-20200814-205922

  1. Select the table you'll work with.
  2. Choose the function.
  3. Specify cell coordinates as static values or via variables.
  4. Variable for the result.
Example

Save the value from cell B2 of ❗→ Table 1 to a variable

image-20200814-210356

Contents of ❗→ Table 1

image-20200814-211524

After running the action, the result is saved to variable *yacheika

image-20200814-210857

Sort table

Sort table elements in ascending or descending order.

image-20200814-212049

  1. Select the table you'll work with.
  2. Choose the function.
  3. Zennoposter will automatically detect columns that have values and offer a selection.
  4. Use number comparing logic (this works when the column only has integers. If there are floating-point values, the column is sorted as strings).
  5. Set the sort type: *descending or *ascending.
Example

Sort all columns of ❗→ Table 1 in descending order

image-20200814-212913

❗→ Table 1

Before processing

image-20200814-214045

After processing

image-20200814-214156

Save to file

Save the table to a file during project execution

image-20200814-214404

  1. Select the table you'll work with.
  2. Choose the function.
  3. Select the file or specify a variable containing the file path.
Warning

The function only overwrites files

Example

Save the values of ❗→ Table 1 to a file

image-20200814-214710

Contents of ❗→ Table 1

image-20200814-214822

After execution, all values will be saved to the file

image-20200814-214959

Remove duplicates

Remove duplicate values from the table

image-20200814-215041

  1. Select the table you'll work with.
  2. Choose the function.
  3. Zennoposter will automatically detect columns with values and offer a choice.
Example

Remove all duplicates in ❗→ Table 1

image-20200814-215349

❗→ Table 1

Before processing

image-20200814-215602

After processing

image-20200814-215736

Delete column

Completely removes the specified column from the table

image-20200814-215817

  1. Select the table you'll work with.
  2. Choose the function.
  3. Specify the column or variable.
Warning

The column will be deleted with all its values

Example

Delete column B from ❗→ Table1

image-20200815-211121

❗→ Table 1

Before processing

image-20200815-211536

After processing

image-20200815-211711

Delete rows

Deletes the specified rows from all columns

image-20200815-213422

  1. Select the table you'll work with.
  2. Choose the function.
  3. Row criteria (can use a variable): a) All b) Does not contain text c) Does not match a ❗→ regular expression d) First e) ❗→ By index (indexing from zero!) f) Random g) Contains text h) Contains only whitespace i) Matches a ❗→ regular expression
Warning

The specified row will be deleted in all columns

Example

Delete the third row from ❗→ Table 1

1NFJfjUKn7

❗→ Table 1

Before processing

2020-07-25_13-31-21

After processing

2020-08-03_20-40-14

The third row was removed entirely

Recommendations for working with tables

Note

Follow these rules to ensure your projects work correctly

  • Avoid linking very large files (hundreds of megabytes) to a table without the “❗→ Save table changes to file” option, especially if you have little RAM.
  • When you use a table linked to one file in several templates, use the same delimiter. If in one template your columns are separated by ; and in another by -, you will get an error.
  • If you run your template in multithreaded mode and want each thread to work with its own row, enable the “❗→ Save table changes to file” option and take data from the table with ❗→ deletion after fetching.
  • If all projects are only reading from the file, there shouldn’t be any issues. When you sync with the file, there’s one table for all threads and all changes in any thread are reflected in the table.
  • If you don’t use file syncing, then a separate table copy is created for each thread. In this case, deleting a row in one thread won’t affect the table in others.
  • Keep in mind that tables in RAM take up much more space than the original file on disk. For example, a table based on a 10 MB CSV file in 100 threads without file syncing can take up 5 GB in RAM. Try not to use lists and tables in “without syncing” mode unless absolutely necessary.

Usage example

Collect the names of needed products from web pages into a list and add them from the list to a table for further use.

2020-08-03_20-54-19

  1. Load the pages.
  2. Collect the required values into a list.
  3. Create a table.
  4. Add the action and specify Add list.
  5. Specify the list and column to save values to.
  1. ❗→ Table
  2. ❗→ Google Sheets
  3. ❗→ List
  4. ❗→ List operations
  5. ❗→ Project variables
  6. ❗→ Regex tester
  7. ❗→ Value ranges