Help

How to programatically import CSV to AirTable, creating a new table in an existing base (CSV is a file on a cloud VM)?

Topic Labels: API
12320 23
cancel
Showing results for 
Search instead for 
Did you mean: 
Dev_Local
6 - Interface Innovator
6 - Interface Innovator

I am sure this has been asked before, I have searched high and low, and have found no solution to do the following, even with Zapier.

I have a .csv file that I want to import direct to Airtable.

The .csv was created programatically (in Node.js), and exists on a Google Cloud VM (Red Hat Linux).

There is nothing in the AirTable API that allows for direct insertion of a full CSV as a new tab in an existing base.

I want to name the tab in the existing base the same name as the CSV file, without the .csv extension.

If anyone has actually done this successfully, and smoothly, please respond. The only articles I can find on how to import a CSV to AirTable involve a human being and clicking in the browser.

23 Replies 23

Here’s the problem. At the top of your code, you import the “requests” module:

Later on, you redefine “requests” in your loop to be one of the extracted items from a row:

Now “requests” is a string, and no longer points to the requests module, hence the error when you later try to use “requests” as though it were the module.

Paul, what is this highlighted line supposed to be doing? It’s retrieving a value from a list, right? What value is it and why is it named “requests”? This is probably stepping all over the imported requests library (import requests, json) which would eliminate the post method for this import thus explaining the runtime error message.

image

That’s a great option, and increasingly we see CSV data hosted for open access. The entire miniExtensions suite is ideal for proving process models and even sustained process. I particularly like the linked-records from form extension.

People tend to build integration processes for many reasons including - they need to own the IP, or they have other adjacent processes that are dependent on the integration. Increasingly, IT groups are pressuring “near-code-free” integrations to be fully transparent so they can pass security audits.

When I see people using Python with Airtable’s API, the first thing that comes to mind is a probable tilt toward data science. Projects of this nature tend to represent a deeper transformation process that is performing computations in Pandas or Numpy and then pushing the results into Airtable. In this particular example it is very simple - read CSV --> write Airtable. But we cannot rule out the possibility that this is a trial integration to see how well Python plays with Airtable.

This is why I never ask users why they want to do something in Python; they largely have good reason and I give them a wide berth because no one would pick Python over Javascript unless they had good reason. :winking_face:

Lots of reasons to actually write code; the requirements pretty much dictate the most effective approach.

Andy_Cloke
8 - Airtable Astronomer
8 - Airtable Astronomer

This is really easy to do using the Data Fetcher extension. It’ll also suggest and create new fields in your Airtable base based on the CSV data. e.g. fields with text in will suggest single line text fields: