Skip to content

Instantly share code, notes, and snippets.

@sivcan
Last active June 18, 2022 10:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sivcan/b1ec8b03aed303788808626a09017c96 to your computer and use it in GitHub Desktop.
Save sivcan/b1ec8b03aed303788808626a09017c96 to your computer and use it in GitHub Desktop.
Airtable scraper script (DevTools)
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