Help

Trouble retrieving Linked records for airtable => google sheet script

Topic Labels: Automations
251 1
cancel
Showing results for 
Search instead for 
Did you mean: 
manurk112
4 - Data Explorer
4 - Data Explorer

Hi, 


I want to export the whole content of my database to google sheet, in order to make advanced analysis in google sheet. 

I wrote the following code to do that, which works, but i have an issue with the linked recors. he gives me the airtable code of the records, not what i see in the cell on airtable. Any idea how i can manage that? 

I also try to use Bardeen as a work around, but i have the same issue. Linked records come back as RecordID, not as texts. 


Thanks a lot!

1 Reply 1
Alexey_Gusev
13 - Mars
13 - Mars

Hi,

preferably, please use this tag, otherwise it's not convenient to read the code.

Alexey_Gusev_1-1726144385729.png

You should change the part with 

 

 

if Array.isArray.... lenght>0..
return value.join('; ')

 

 

 Usual value of a link record cell is array of objects having id and name
Alexey_Gusev_0-1726144321183.png
in JS, it would be value.map(obj=>obj.name).join('; ')
but there are other field types, for example attachments field, which value is array of objects too, but these objects has no 'name' property. You can get their filename  (you can get 'url' property and then do something to load into sheet, but be aware that url will be unreachable after a few hours) Lookup fields has no 'name' and 'filename', can be retrieved simple by a value.join. To summarize, it's something like

 

 

value.map(v=>v.name||v.filename||v).join('; ') 

 

 

I don't know whether it work, but you got the idea.