The error for the A and B column comes from the fact that pgfplotstables
expects numerical data unless specified otherwise. To make the column handle strings, you have to set columns/colnames/.style={string type}
.
To get the index to start at one, I would suggest to create a new column on the fly and using this for the column names with the key colnames from=<name>
.
Here's an MWE:
\documentclass{article}
\usepackage{pgfplotstable}
\usepackage{filecontents}
\begin{filecontents}{testdata.dat}
A B
1.0 20
1.1 21
1.2 22
1.3 23
1.4 24
\end{filecontents}
\begin{document}
\pgfplotstableset{
create on use/index/.style={%
create col/assign/.code={%
\pgfmathtruncatemacro\entry{\pgfplotstablerow+1}%
\pgfkeyslet{/pgfplots/table/create col/next content}{\entry}
}
}
}
\pgfplotstabletranspose[colnames from=index]\loadedtable{testdata.dat}
\pgfplotstabletypeset[
columns/colnames/.style={
string type,
column name={\#}
}
]\loadedtable
\end{document}
