Consolidating/Merging multiple tables in one

Hey, I could not find any solution on this anywhere online, but I am sure that there is a way to do this.
I am using the self-hosted enterprise version of SeaTable 4.4.9
We have multiple Tables with financial data in one base and want to merge it into one Table.
All the tables contain the same kind of data with the exact same columns, just from different departments. Just linking them would not work since there are multiple ones, and exporting and importing manually would be very manual.
Data Processing “Lookup and copy” or “auto add link” does not work either since we have no equal columns.
I just want to append any new data that is not already entered. Is manually the only way to do this, or are there ways around this through python scripting maybe?

Unfortunately, there is no no-code way of merging tables in SeaTable at this point in time. (We may add such a feature in the future.)

Part of the reason that SeaTable does not feature a merge function is that a Python script suitable for the job is rather simple.

1 Like

Thank you again for your quick answer. Is there an example script I can find somewhere? I know some python, but as a general non coder and seatable newbie I do not feel confident writing one myself. @rdb

#Specify source and dest table
source_table = "Source"
dest_table = "Dest"

##

from seatable_api import Base, context
base = Base(context.api_token, context.server_url)
base.auth()

#Load all columsn from source table
sql = "select * from " + source_table
rows_to_copy  = base.query(sql)

#Append rows to dest table
base.batch_append_rows(dest_table, rows_to_copy)

That’s a basic script that takes all rows from the table in the source_table variable and copies the rows to the table in the dest_table variable.

The column names in source and destination table must be identical. Also, if you run the script twice, the rows are copied twice.

So a simple addition would be to add an column in the source table in which you mark rows as “already copied”. So with a simple addition of a WHERE condition to the SQL statement, you can copy only the rows that haven’t already been copied.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.