Here is a very short tutorial how to generate some rows with a Python-Script.
Here is how it looks like:
The script is simple:
- The first part is the authentication against the current base.
- I create a loop that is executed ten times.
- Every time I define row data to create two new rows
- I append the two new rows
- The loop goes on until 10 runs were completed.
In this way, you can generate a lot of dummy data in a very short time.
Please be aware that the column structure has to be created first. The columns are not generated on the fly.
And here is the code:
from seatable_api import Base, context
import random
server_url = context.server_url
api_token = context.api_token
base = Base(api_token, server_url)
base.auth()
# execute batch append multiple times
for i in range(10):
# define the data for two new rows
rows_data = [
{
'Name': "I am new Row",
'single': "new",
'random': random.randint(0,100000000),
'rating': random.randint(0,5)
},
{
'Name': "I am second new row",
'single': "more than new",
'random': random.randint(0,100000000),
'rating': random.randint(0,5)
},
]
# append the two rows
base.batch_append_rows(context.current_table, rows_data)