Question
How to import a mailing list from a CSV using Python?
I'm trying to write a Python script that imports a mailing list from a CSV file straight to a Qualtrics mailing list. I have the Qualtrics API and have only managed to import one contact. Is it possible to import multiple contacts at once? My script currently looks like this:
import requests
import pandas as pd
df = pd.read_csv("<filepath\\maillist.csv>", index_col=None)
apiToken = "<apiToken>"
baseUrl = "<https://qualtrics.com/maillist>"
headers = {
"x-api-token": apiToken,
"Content-Type": "application/json"
}
json = pd.DataFrame.to_json(df)
response = requests.post(baseUrl, json=data, headers=headers)
print(response.text)
The CSV contains these columns: Email Address, First Name, Last Name, ExternalID and Language.
There are two rows of data however when I run the above script it will only send across the first row.
Any ideas how to send across multiple rows?
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
