I'm reproducing an example from this tutorial. If the input from the csv file is numeric, it works well. However, if one of the columns of the csv contains alphabetic characters, it returns an error message.
I added string type, after seeing this question, to no avail.
I've been tinkering a while with it and considered reading the pgfplotstable manual from cover to cover and try to make a custom table from scratch. However, that defeats the purpose of taking advantage of an 'already cooked' example.
Which is the correct way of doing this?
The MWE is as follows.
\documentclass{article}
\usepackage{booktabs} % For \toprule, \midrule and \bottomrule
\usepackage{siunitx} % Formats the units and values
\usepackage{pgfplotstable} % Generates table from .csv
\pgfplotsset{compat=1.11}% supress warning
% Setup siunitx:
\sisetup{
round-mode = places, % Rounds numbers
round-precision = 2, % to 2 places
}
\begin{document}
\begin{table}[h!]
\begin{center}
\caption{Autogenerated table from .csv file.}
\label{table1}
\pgfplotstabletypeset[
multicolumn names, % allows to have multicolumn names
col sep=comma, % the seperator in our .csv file
string type, % Added in hopes of enabling alphabetic input.
display columns/0/.style={
column name=$Value 1$, % name of first column
column type={S},string type}, % use siunitx for formatting
display columns/1/.style={
column name=$Value 2$,
column type={S},string type},
every head row/.style={
before row={\toprule}, % have a rule at top
after row={
\si{\ampere} & \si{\volt}\\ % the units seperated by &
\midrule} % rule under units
},
every last row/.style={after row=\bottomrule}, % rule at bottom
]{table.csv} % filename/path to file
\end{center}
\end{table}
\end{document}
My (working) csv input is:
Its output is:
And I would like to input:
And get an analogous output. i.e. Words in the first column. However, in its current form, it returns the following error, as seen in he test.log.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! siunitx error: "duplicate-exponent-token"
!
! Duplicate exponent marker token '\token_to_str:N e' in input.
!
! See the siunitx documentation for further information.
!
! For immediate help type H <return>.
!...............................................
l.37 ]{table.csv}
% filename/path to file
?
! Emergency stop.
!...............................................
l.37 ]{table.csv}
% filename/path to file
|'''''''''''''''''''''''''''''''''''''''''''''''
| Only one exponent marker token can appear in a single number.
|...............................................



