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.

Overview

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:

import csv

csv_raw = """
a,simple,csv
1,2,3
4,5,6
"""

csv_data = csv_raw.splitlines()[1:] # Discard the blank first line.
csv_reader = csv.reader(csv_data)
for row in csv_reader:
print(row)

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.

Your protocol can use the usual Python I/O to read the file, and the csv module to parse it.

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.



Did this answer your question?