Help

How can i export single selection into csv?

Topic Labels: Base design
2728 4
cancel
Showing results for 
Search instead for 
Did you mean: 
kennypurnomo
7 - App Architect
7 - App Architect

Hi,

Any way i can export these items?
FB_IMG_1656515771981

4 Replies 4

I think there’s a way to do this with scripting, but someone else would need to chime in on that.

The only quick way that I can think of would be to make sure that each one of those options is already chosen for at least one record in your table. Then, convert the field to a linked record field, and then go to the new table that is created and export as CSV from there.

You can always revert the linked record field back to single select afterwards, although note that this entire process will update the “last modified time” in all of the records in your table.

You might also be able to do this with On2Air: Schemas. @Hannah_Wiginton would need to chime in on that one.

Scott’s option is probably best to create a record with each option.

On2Air Schemas will show you any options from your select fields but unfortunately, won’t export these options.

______________________________________
Hannah - On2Air.com - Automated Backups for Airtable

Hi Kenny, I’ve set something up here with a scripting app that may help

How can i export single selection into csv_

Not a real export, but should get you 90% there probably.

Code:

let settings = input.config({
    title: `Display select field options`,
    description: `Select the table that contains the field, and the field you want to display the options of`,
    items: [
        input.config.table('table', { label: `Table` }),
        input.config.field('field', { parentTable: `table`, label: `Field` }),
    ],
});

let { table, field } = settings;

if(field.type === "singleSelect" || field.type === "multipleSelects"){

    let options = new Array;

    for (let choice of field.options.choices){
        options.push(choice.name)
    }
    output.text(options.toString())
}
else{
    output.text(`Selected field is not a single select or multiple select field`);
}

Thank you Adam @TheTimeSavingCo This saved me a load of time. I made a slight mod for myself that may be helpful for others if you want to copy/paste into a spreadsheet to use later. 

// User selects table
let Table = await input.tableAsync('Pick a table');
let FieldOptions = Table.fields;

//loop through all the fields in the table
for (let I in FieldOptions){
    let ThisField = FieldOptions[I];
    // check if the field is a single or multiselect
    if(ThisField.type === "singleSelect" || ThisField.type === "multipleSelects"){
        // create new array and push all the options for the current field to the array
        let options = new Array;
        for (let choice of ThisField.options.choices){
            options.push(choice.name)
        }
        // Join the array and out put with the name of the field.
        let Output = options.join(`;\n`);
        output.text(ThisField.name + `;\n` + Output);
    }
}