Jan 07, 2023 02:03 PM
Hi,
Sorry about the newbie question: via scripting, I´m trying to import a csv using .parsedContents however my csv has several spaces and non-AlphaNumeric characters in the headers so when I come to map the fields I don´t know how to specify them, for example line 4 in this snippet there´s a space between LAST and NAME:
1 let newRecords = fileRows.map(fileRow => ({ 2 fields: { 3 'Email': fileRow.email 4 'Last Name': fileRow.last name, 5 } 6 }))
As I have several files to import several times a month I would not like to have to "cleanup" the csv in some other spreadsheet as it´d defeat the whole purpose of using airtable as I already have (an ugly) way of doing it all in excel.
Or is there a way to use the extension CSVImport via scripting using a predefined csv>table field pairing for each table?
Also, I´m wondering if it´s possible to run a script any other way apart from the side extensions panel. Is there any way to have a custom button or hotkey to run a script?
Thanks in advance,
Chris
Jan 20, 2023 01:58 PM
Hi Chris! This might be a request that is best suited for an email to Support so that we could dig in a bit further, but as an initial guess, it might work to try fileRow["last name"] instead of fileRow.last name. More on this JS syntax here.
Regarding the follow-up questions:
Hope that this can help point you in the right direction!
Feb 15, 2023 05:22 AM
Thanks Juliana, the JSSyntax you mentioned was what I was looking for. Thanks!