Last active
June 18, 2022 10:25
-
-
Save sivcan/b1ec8b03aed303788808626a09017c96 to your computer and use it in GitHub Desktop.
Airtable scraper script (DevTools)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let columns = temp1.table.columns, | |
identifiers = { | |
'Company name': 'name', | |
'City': 'city', | |
'Where to apply': 'url', | |
'Status': 'status' | |
}; | |
function getData (row) { | |
return _.reduce(columns, (acc, column) => { | |
if (_.includes(Object.keys(identifiers), column.name)) { | |
if (row.cellValuesByColumnId[column.id]){ | |
if (column.name === 'Status') { | |
let statuses = row.cellValuesByColumnId[column.id]; | |
statuses = _.map(statuses, (status) => { | |
return _.find(temp1.table.columns[1].typeOptions.choices, { id: status }).name; | |
}); | |
acc.status = statuses; | |
} | |
else { | |
acc[identifiers[column.name]] = row.cellValuesByColumnId[column.id]; | |
} | |
} | |
} | |
return acc; | |
}, {}); | |
} | |
let data = _.map(temp1.table.rows, (row) => { | |
return getData(row); | |
}, {}); | |
copy(data); // Copy the entire data to clipboard |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment