This article is for when you're developing a protocol yourself with Python. If we're writing a custom protocol for you, see Using CSV input data in custom protocols.
CSV files can store a table of values. You might want to use them for things like specifying liquid volumes across a well plate.
Since protocols written with our Python Protocol API have the full power of Python, they can read, parse, and use CSV data however you want! 👩💻
Ways of using CSV data in Python protocols
Embed the data into the protocol itself
The easiest way to use CSV data in your Python protocol is just to open the CSV in a text editor and copy and paste the CSV data into your Python script as a big string. From there, you can use the standard csv module to parse the data like this:
csv_raw = '''
csv_data = csv_raw.splitlines()[1:] # Discard the blank first line.
csv_reader = csv.DictReader(csv_data)
for csv_row in csv_reader:
source_well = csv_row['source_well']
destination_well = csv_row['destination_well']
transfer_volume = float(csv_row['transfer_volume'])
Upload the files over the command line with scp
If you prefer to keep the CSV data in its own file, you can use
scp to upload it to your OT-2. This requires some familiarity with the command line. See: Copying files to and from your OT-2 with scp.
Can I upload CSV files through the Opentrons App?
Currently, the Opentrons App does not support uploading CSV files. Use one of the above alternatives instead.