Thank you. I have this so far:
// Airtable integration with PAT
const airtable = Airtable.configure({
apiKey: ScriptApp.getEnvironment().getVariable('AIRTABLE_PAT')
});
const table = airtable.base('appCf1sGZAwiIBU6k/tbleWwX6yxhZY8aHk').table('tbl3QwmZLBau3rK5P');
but Airtable.configure requires the library.
Experience? Not much. Enough to do small things with the help of ChatGPT and Bard. Sorry.
Ah, no worries! You mentioned you weren't too sure how to use your PAT, so here's how I would set up my PAT so that you have a reference:

You'll just need to give it write permissions and select the base you want to send data into
Here's a script that will create new records in a base of your choice:
function main(){
var myHeaders = {
"Authorization": "Bearer YOUR_PAT_HERE",
"Content-Type": "application/json"
};
var raw = JSON.stringify({
"records": [
{
"fields": {
"Label": "Test1"
}
}
]
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
payload: raw
};
var response = UrlFetchApp.fetch("https://api.airtable.com/v0/appz6YcyO3dXfqDWV/tblsCy38oC7N7FE4c/", requestOptions);
console.log(response.getContentText());
}Just replace "YOUR_PAT_HERE" with your PAT, as well as update the URL in the fetch to be your base and table ID, specifically this bit:
https://api.airtable.com/v0/appz6YcyO3dXfqDWV/tblsCy38oC7N7FE4c
You'd update it so that it was https://api.airtable.com/v0/YOUR_BASE_ID/YOUR_TABLE_ID
And you can get your base and table ID from going to the specific table you need, where the URL would be, for example:
https://airtable.com/appz6YcyO3dXfqDWV/tblsCy38oC7N7FE4c/viwFuVZVRlLEUiCpL?blocks=bip4Em7XSFdFnv5yF
And the base ID would be: appz6YcyO3dXfqDWV
And the table ID would be: tblsCy38oC7N7FE4c
I realize that you probably already some if not most of this stuff, but figured I'd err on the side of oversharing in case it helped! Let me know if you could use more help and I'll see what I can do