Select Page
How to View and Backup Airtable Metadata with On2Air Backups

How to View and Backup Airtable Metadata with On2Air Backups

On2Air Help CenterOn2Air Help Center > On2Air BackupsOn2Air Backups Start a free trial

In this tutorial, you’ll learn how to use On2Air Backups to backup and view your Airtable base meta-data. Meta-data is the “data about the data”, including your Airtable base structure and how it’s built, like table names, IDs, field names, field types, field IDs, number of fields, and more.

image
💡
What is On2Air Backups?

On2Air Backups creates automated backups of your Airtable data and sends the data to your storage drive in Google Drive, Dropbox, and Box. Get a free backup

In this tutorial

🎥 Tutorial Video - How to View and Backup Airtable Metadata with On2Air Backups

How to Create Your Airtable Base Meta-Data

There are 2 ways you can get your Base meta-data. Either option is available to use.

  • Meta.json File in Every Backup
  • Script Added to the Scripting Extension in Your Base

Option 1 - Meta.json File in Backup Files

You’ll need to have a completed backup from On2Air Backups in your storage drive to view your base meta-data. These are automatically included with any backup.

Each Airtable base includes an individual meta.json file. A json is used to structure data. Whether your Backup Project has one or multiple Airtable bases, each base will have its own meta.json file with the meta-data to that Base alone.

  • Once your Airtable data is backed up, you’ll have a file in your cloud storage labeled meta.json
  • image
  • Open the meta.json file -
    • The file will look similar to this example, but with your Airtable base information
    • image
  • Copy the entire contents of the file
    • You may need to download the meta.json file and open it in a text viewer like Notepad if you’re unable to copy it or you can’t paste it into our Meta viewer field in the next step
    • image
  • In the On2Air Backups app, click on Meta Viewer in the menu

image
  • Paste the meta.json data into the Paste Meta Info field

image
  • Click Process
  • You’ll then see your Airtable base meta-data
image

Option 2 - Script Added to the Scripting Extension in Your Base

Add the Scripting Extension to the Base where you need meta-data

  • Copy this script into the Scripting Extension and click Run

Link to Script

SCRIPT

/**
 * On2Air Backup Scripts
 * Owned by On2Air.com
 * All rights reserved.
 * Copyright 2023
 * 
 */

output.markdown("# On2Air Backups Scripts")
output.markdown('##### Scripts assocated with On2Air: Backups. All rights reserved.')
const tools = ['Meta','Attachments']
const tool = await input.buttonsAsync('Select Tool', tools)
if(tool === tools[0]){
    //meta
    output.markdown("# Meta Data - Copy Full Data Below")
    output.text(JSON.stringify(base, null, 2))
    // output.text()
    
}else if(tool === tools[1]){
    const table = await input.tableAsync("Select Table containing attachments")
    const attFields = table.fields.filter( f => f.type === 'multipleAttachments')
    output.markdown("# Select an Action")
    const options = ['Display Field IDs', 'Search by Record', 'Search by Att']
    const selection = await input.buttonsAsync('Select', options)
    const index = options.indexOf(selection)
    switch(index){
        case 1:{//by record
            output.markdown("## Search by Record Name")
            const recMatch = (await input.textAsync("Enter Search")).toLowerCase()
            const records = (await table.selectRecordsAsync({fields:attFields})).records
            output.table( records.filter( r => r.name.toLowerCase().includes(recMatch)).map( r => {
                const out = {id:r.id,name:r.name}
                for(let af of attFields){
                    out[af.name] = (r.getCellValue(af) || []).map( a => a.id + "\t|\t" + a.filename).join("\n")
                }
                return out
            }) )
            break;
        }
        case 0:{//att field
            output.markdown('## Attachment Fields in Table: ' + table.name)
            output.table( attFields.map( af => ({name:af.name, id: af.id})))
            break;
        }
        case 2:{//search by att id
            output.markdown("## Attachment Search")
            const recMatch = (await input.textAsync("Enter Search by Att Value")).toLowerCase()
            const records = (await table.selectRecordsAsync({fields:attFields})).records
            const matches = []
            records.forEach( r => {
                for(let af of attFields){
                    const items = (r.getCellValue(af) || [])
                    for(let item of items){
                        if(item.id.toLowerCase().includes(recMatch) || item.filename.toLowerCase().includes(recMatch)){
                            matches.push({record_id: r.id, name: r.name, field_id: af.id, field: af.name, att_id: item.id, att_name: item.filename})
                        }
                    }
                }
            })
            output.markdown("## Matching Attachments")
            output.table( matches )
            break;
        }
    }
}
  • Paste the Script that was generated into the Meta Viewer field in On2Air Backups
image
  • Click Process
  • You’ll then see your Airtable base meta-data
image

How to Navigate the Meta Viewer

Now that you have your meta-data, you can view more details.

  • You’ll see a list of every Table in a single Airtable base and you’ll see the Fields, Field IDs, Views, and more metadata info
image
  • Click See Options to see specific details about that specific field and field type. Each Field Type has various metadata details depending on the field type.
image
  • Depending on the field type, you can see specific metadata per type
    • Example: Checkbox field types include the Icon and the Icon Color
image