I propose the following:
\documentclass{article}
\usepackage{xcolor}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.16}
\usepackage{booktabs}
\begin{document}
\pgfplotstabletypeset[
columns/c1/.style={column type={c}, column name=Story, string type},
columns/c2/.style={column type={c}, column name=$U_x$, sci, precision=2},
columns/c3/.style={column type={c}, column name=$U_y$, sci, precision=2},
every head row/.style={before row={\toprule}, after row=\midrule},
every last row/.style={after row={\bottomrule}},
my special cell/.style={@cell content=\textcolor{blue}{#1}},
every row 3 column 2/.append style={
postproc cell content/.append code={%
\pgfkeysgetvalue{/pgfplots/table/@cell content}{\myTmpVal}%
\pgfkeysalso{my special cell/.expand once={\myTmpVal}}%
},
},
col sep=&, row sep=\\]{%
c1 & c2 & c3\\
Story4 & 33.7835 & 33.7878\\
Story3 & 38.4334 & 38.4367\\
Story2 & 37.7156 & 37.7156\\
Story1 & 38.4056 & 38.4034\\}
\end{document}
For your specially-colored cell, this uses the following style:
my special cell/.style={@cell content=\textcolor{blue}{#1}}
to which I pass the cell contents after sci
formatting has been applied (the value of /pgfplots/table/@cell content}
is retrieved at the right time, then passed to the my special cell
style).
Note that if you replace:
every row 3 column 2/.append style={
postproc cell content/.append code={%
\pgfkeysgetvalue{/pgfplots/table/@cell content}{\myTmpVal}%
\pgfkeysalso{my special cell/.expand once={\myTmpVal}}%
},
},
with:
every row 3 column 2/.append style={
postproc cell content/.append style={
my special cell=##1,
},
},
you'll see this instead:
because the first argument of /pgfplots/table/postproc cell content
is defined as
the unprocessed input argument as it has been found in the input table
(see Postprocessing Cell Content in the pgfplotstable manual).
Regarding your last sentence, you can use a .csv
file even for your minimal working example, thanks to the filecontents*
environment of the LaTeX kernel:
\documentclass{article}
\usepackage{xcolor}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.16}
\usepackage{booktabs}
\begin{filecontents*}{my-data.csv}
c1 & c2 & c3
Story4 & 33.7835 & 33.7878
Story3 & 38.4334 & 38.4367
Story2 & 37.7156 & 37.7156
Story1 & 38.4056 & 38.4034
\end{filecontents*}
\pgfplotstableread[col sep=&]{my-data.csv}\myLoadedTable
\begin{document}
\pgfplotstabletypeset[
columns/c1/.style={column type={c}, column name=Story, string type},
columns/c2/.style={column type={c}, column name=$U_x$, sci, precision=2},
columns/c3/.style={column type={c}, column name=$U_y$, sci, precision=2},
every head row/.style={before row={\toprule}, after row=\midrule},
every last row/.style={after row={\bottomrule}},
my special cell/.style={@cell content=\textcolor{blue}{#1}},
every row 3 column 2/.append style={
postproc cell content/.append code={%
\pgfkeysgetvalue{/pgfplots/table/@cell content}{\myTmpVal}%
\pgfkeysalso{my special cell/.expand once={\myTmpVal}}%
},
}]{\myLoadedTable}
\end{document}