Using the scripting block to copy (adding, really) records from one base to another

Hi!

I’ve been looking around the forum and Reddit for a solution to copy records from one base to another using the scripting block. I just want to know if this is possible and maybe see an example to use as a reference.

The idea is to get all the records from Base A Table 1 and copy them to Base B Table 1, without deleting existing ones. I need to have different bases so the data and permission management is easier.

Thanks for any help!

Welcome to the community, @Sebastian_Murillo2! :smiley: Unfortunately Airtable’s blocks, including the scripting block, can only access records within the base where they reside. Cross-base operations aren’t possible via blocks.

However, you can do what you want with the help of an integration service like Zapier or Integromat. I’ve got a video production base, for example, where I organize various video projects. When I change a project to a new status—e.g. from Pre-Production to Production—an Integromat scenario notices the change in that base, and adds records to my planning base for the tasks tied to that new status. Something similar could be set up to copy/update records between your bases.

1 Like

Welcome @Sebastian_Murillo2!

As @Justin_Barrett mentioned, the scripting block API does not have any functions to perform inter-base calls (like reading/writing). Depending on your skill level, Justin’s recommendation for using a Zapier/Integromat integration is probably the most user-friendly option.

However, if you are looking for something more complicated, but Scripting Block-specific, you could use the Airtable Standard API which can perform read, write, update, delete operations for any base, given you have the base ID accessible.

To flesh this idea out a little further, imagine:

  1. You write a scripting block in base A. Step one is passing in the base ID for base B.
  2. The scripting block then performs a fetch() call to the Airtable API for “listing records” (a GET request).
  3. You parse the JSON response (which includes the records from base B), and using the scripting block createRecordsAsync() pass in the response to copy the records into base A.

Again, a little more complicated because you have to use two of Airtable’s APIs, but should be able to keep all the code within the scripting block.

3 Likes

Thanks a lot @Justin_Barrett and @Matthew_Thomas! Both answers are excellent I will explore both. Integromat for now just as a quick solution and the API script for the long road.

Best!

1 Like

Glad to know that you got the answer you were seeking! If you would, please mark the appropriate comment as the solution to your question. This helps others who may be searching with similar questions. Thanks!

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