Aug 01, 2023 11:52 PM
Hello Airtable Community,
I am new to Airtable and currently working on a custom mini extension in Airtable that aims to upload CSV files into multiple tables within my base automatically. I have written a script for the mini extension to handle the CSV upload and record creation, but I'm encountering some errors.
- The script prompts the user to upload a CSV file using the built-in file picker.
- The CSV file has data that needs to be distributed across different tables, namely: contacts, company, line items, services, and invoices.
- Each table has unique fields and linked records, and the script maps the CSV data to the appropriate fields accordingly.
- I am using native JavaScript to read and parse the CSV content.
Issue:
When testing the mini extension and attempting to upload the CSV file, I encountered the following error: [Describe the specific error message you received, if any].
Code:
Javascript:
I expect the script to read the CSV file, map the data to the corresponding fields in each table, and create new records accordingly.
Request for Help:
I would greatly appreciate any guidance or assistance with debugging the script and resolving the errors. Specifically, I need help with:
- Parsing the CSV content and ensuring it aligns with the table structures.
- Handling linked records and correctly mapping them from the CSV data.
- Verifying the implementation of each table's fields and data in the script.
Any insights or suggestions on how to improve the code would be incredibly helpful!
Thank you in advance for your support.
Best regards,
Narcy
Aug 02, 2023 03:38 AM - edited Aug 02, 2023 03:39 AM
Sorry, I don’t know scripting, so other people will need to chime in below to help you with your scripting errors.
However, in the meantime, while you’re waiting for others to help:
If you’d like to skip scripting altogether and do all of this in a no-code/low-code way, there is an easy way to automatically import CSV files into Airtable with no coding at all, along with having all of the data map into the appropriate tables with the appropriate linking.
All of this can be done in a no-code/low-code way with Make’s CSV modules and Make’s Airtable modules.
I just discussed importing CSV files with Make on last week’s episode of the BuiltOnAir podcast, so you can see exactly how it’s done.
(There can be a bit of a learning curve with Make, which is why I created this basic navigation video for Make, along with the links to a few other Make training resources.)
p.s. If you’d like to hire an expert Airtable consultant to help you with any of this, please feel free to contact me through my website: Airtable consulting — ScottWorld
Aug 04, 2023 10:32 PM
Hi,
I would suggest to use
because unformatted code is hard to read, so it's a small chance somebody will read it.
But the most important is which part of your code is written by chatbot. Airtable has several contexts for coding, each with it's own little part of commands and ways to manage the data. Chatbot "uses all of them at full power", that means such code has very little chance to run, with significant part of overengineering, and in most cases it's easier to write new from scratch.
When you open code editor in "Extensions", you can click on Examples and see Spreadsheet Importer, loading single file. I guess you already seen it, but I can't say for sure whether it possible to modify it to load several tables from a single file.
I think, it's hard to 'explain' built-in file picker that 'here finishes table 1 and table 2 should begin', as such feature doesn't installed in it.