PeakWright / Guides / Into CSV
Getting ChemStation data into CSV
Once you can read the file, you usually want the numbers somewhere else: a spreadsheet, a script, a plot for a paper. Two columns, retention time against signal, at the resolution the instrument actually recorded.
The quickest route. Open the file in
the viewer and press C. It writes a CSV of the active trace
with retention time in minutes in the first column and the signal in the second, one row per
recorded point. Nothing is uploaded and nothing is installed.
What a good export contains
A two column CSV with a header row, retention time in minutes, and one row for every point the detector recorded. That is it. The things worth checking in whatever tool you use:
- Full resolution. No thinning, no smoothing, no resampling onto round numbers. A run at a high sampling rate produces a lot of rows and that is correct.
- Real time values. The times should come from the file's own start, end and sampling rate, not be reconstructed by assuming a step.
-
Scaled signal. The body of a
.chfile holds raw counts that have to be multiplied by a factor from the header. An export that skips that gives you the right shape and meaningless numbers. - A named unit. Milli absorbance units and picoamps are not interchangeable, and six months later the header row is the only thing that tells you which you had.
The routes
The viewer, for one file at a time
Drop the file in, press C, and you get a CSV named after the file. It exports the
active trace, so if the run has several channels you switch channel and export again. This is
the right route when you have a handful of files and a deadline.
rainbow, for many files
rainbow reads Agilent
.D directories in Python and hands you arrays, which you then write out however
you like. If you have two hundred runs to process, this is the answer and a viewer is not.
chromConverter, for R
chromConverter reads a wide range of vendor formats into R data frames and can write them out. If your analysis already lives in R, export straight into it rather than through a CSV on disk.
OpenChrom, for batches with processing
OpenChrom can batch process and export, and unlike the others it will also integrate peaks. If what you actually want is a table of peak areas rather than a raw trace, that is a different job and this is the free tool that does it.
The trap: two runs, two time axes
Do not paste one run's signal next to another run's time column. Sampling rate and run length are set per method, so two runs rarely share a time axis. A twelve minute run at one rate and a nine minute run at another have different row counts and different time values, and lining them up by row number silently shifts every peak.
If you are comparing runs, keep a time column per run, or interpolate onto a common axis deliberately and write down that you did.
What a CSV throws away
The signal survives. Everything around it does not: the method, the column, the instrument, the injection volume, the operator, the units, the processing history. A CSV is a set of numbers with no provenance.
So keep the original file. Export a CSV to work with, and archive the .D folder
alongside it. Six months later the CSV will not be able to tell you what the run was, and the
folder will.
When CDF is the better target
If the destination is another chromatography data system rather than a spreadsheet, CSV is the wrong format. CDF, also called AIA or ANDI, is the interchange format the field agreed on, and it carries the metadata a CSV drops.
This matters most when you still have access to ChemStation and are deciding what to ask someone to export. A CDF is a better thing to ask for than a CSV, and both are far better than a screenshot.
Exporting a .uv is a different decision
Diode array data is two dimensional, so there is no single obvious CSV layout. One row per time point with a column per wavelength is wide and readable in a spreadsheet. Three columns of time, wavelength and absorbance is long and easier to script over.
In practice most people want one wavelength, which is an ordinary two column CSV again. See reading .uv DAD data.
If you want to send it rather than analyse it
A CSV is a poor thing to email someone, because they have to plot it before it means anything. The viewer also exports a single self contained HTML file holding the trace, which opens by double clicking, needs no software and no internet, and keeps hover and zoom. For "have a look at this run", that travels much better than a spreadsheet.
Export a CSV now
Drop a .ch or .uv in, and press C. Full resolution,
real retention times, scaled signal, and the file never leaves your machine.
PeakWright is not affiliated with or endorsed by Agilent Technologies. "ChemStation" and "OpenLab" are their trademarks.