Skip to main content

Trouble retrieving Linked records for airtable => google sheet script

  • September 12, 2024
  • 1 reply
  • 24 views

Forum|alt.badge.img+2

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

Alexey_Gusev
Forum|alt.badge.img+25
  • Brainy
  • 1261 replies
  • September 12, 2024

Hi,

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

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

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.