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

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. :wink:

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

1 Like