Help

Re: Script Help - Writing Console.Log to a field

Solved
Jump to Solution
2597 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Acefast
5 - Automation Enthusiast
5 - Automation Enthusiast

I have managed to create a get request (I’m 90% no code) and then info is coming back but how to then write it to a field?.


let table = base.getTable("TARIC Code")
let url = "https://www.trade-tariff.service.gov.uk/api/v2/commodities/";
let config = input.config();
let response = await fetch(url + config.commodityCode );
console.log(await response.json())

I want to take the result directly into a field to then sift through it for what I need.

13 Replies 13

I have no idea if you will hit any limits. I pulled 1 code and it gave me 500+ records. The thing is, ‘the whole lot’ is a bunch of things that can be a number of different types of data (text, numbers…) so if you want to put that data into airtable the type of field needs to match the type of data you have.
Since you are going through the effort of writing a script, you should review the data you are getting and put it in the appropriate place in airtable.

It looks like each object has an id, type and attributes (amongst other things). Try just putting in the id and see how that data looks. Then add the type and grow it from there.

Acefast
5 - Automation Enthusiast
5 - Automation Enthusiast

Thanks for the advice, I really do appreciate that. I’m on my way with this now.

Acefast
5 - Automation Enthusiast
5 - Automation Enthusiast

Out of interest, if I pulled the lot into a long text and broke it up in formulas what would the script be for that?

Airtable unlike excel does not have a native split to cells function. There may be an app that does this but I don’t know.
You can use formulas to FIND() aspects of your text, then you can use LEFT(), RIGHT() or MID() to pull out the text in the location returned from FIND().

I am not sure what your end goal is, but I would guess there is something in that API that you want to keep in Airtable. Instead of using airtable to sort through all of the data, manually keeping only what you want. I would review the data and have my script only gather what I need. I guess the effort would pay off better in the long run.