This is a continuation of my previous question. I have a working Python script that generates a CSV. I can pass it inputs like name and email, and it works great for one row; however, as soon as I change inputs to be multivalued, I cannot figure out how to parse the multivalued inputs in my Python script. My end goal is to push the data from a lookup table to a CSV, but I need to be able to send multivalued inputs to the script in order to populate the CSV (more than 1 row).
See the attached picture. I send it a list of names and emails, but all I receive is names=System.Object[]. If I try to expand what I expect to be an array, it treats it like a string ("System.Object[]" gets put into each column only once). When I specify names[0], ... names[n], I just see S, y, s, t, e, m ... and so on.
Here's my script:
import csv,sys
from datetime import datetime
dt = datetime.today().strftime('%Y-%m-%d-%H%M%S')
csv_file_name = 'C:\\LF Import Agent Uploads\\AP\\APExport-'+dt+'.csv'
names = sys.argv[1]
emails = sys.argv[2]
data = [[names, emails]]
# Write to CSV file
with open(csv_file_name, 'w', newline='') as csv_file:
csv_writer = csv.writer(csv_file)
csv_writer.writerow(['Name', 'Email'])
csv_writer.writerows(data)
print(f"names:{names}")
print(f"emails:{emails}")