I have two csv files: namespgf.csv
Sl. No., Reg. No.,Name,Category,Group,Gate,Sponsored,Department
1,MS001,Ajay-D-Vimal Raj P,PY,OBC,--,No,Physics
2,MS002,Harish Kumar,PY,GE,GATE,Yes,Physics
3,MS003,Ajay-D-Vimal Raj P,PY,OBC,--,No,Physics
4,MS004,Harish Kumar,PY,GE,GATE,Yes,Physics
and markspgf.csv
number,marks
MS001,67
MS002,25
MS003,62
MS004,55
Requirement: I want to print the first file (namespgf.csv) into a long table in which, I would like to include the second column (i.e., marks column) of markspgf.csv, as the column coming after the names column (i.e., as the fourth column).
Here is the MWE (working, but not as I desired)
\documentclass[10pt]{article}
\usepackage[a4paper,margin=2cm]{geometry}
\usepackage{longtable}
\usepackage{pgfplotstable}
\usepackage{array}
\usepackage{filecontents}
%
\begin{filecontents}{namespgf.csv}
Sl. No., Reg. No.,Name,Category,Group,Gate,Sponsored,Department
1,MS001,Ajay-D-Vimal Raj P,PY,OBC,--,No,Physics
2,MS002,Harish Kumar,PY,GE,GATE,Yes,Physics
3,MS003,Ajay-D-Vimal Raj P,PY,OBC,--,No,Physics
4,MS004,Harish Kumar,PY,GE,GATE,Yes,Physics
\end{filecontents}
%
\begin{filecontents}{markspgf.csv}
number,marks
MS001,67
MS002,25
MS003,62
MS004,55
\end{filecontents}
%
\begin{document}
% ----------------------------------------------------------------------%
\pgfplotstableread[col sep=comma]{namespgf.csv}\namespgf
\pgfplotstableread[col sep=comma]{markspgf.csv}\markspgf
\pgfkeys{/pgfplots/table/verb string type}
%
\pgfplotstableset{%
% header=true,
begin table=\begin{longtable},
every first row/.append style={before row={%
% \caption{The caption}%
\textbf{} & \textbf{Reg. No.} & \multicolumn{1}{c|}{\textbf{Name}} &
\multicolumn{1}{c|}{\textbf{Category}} & \multicolumn{1}{c|}{\textbf{Group}} & \textbf{GATE} & \textbf{Sponsored} &\textbf{Department} &\textbf{Marks} \\ \hline\hline
\endfirsthead%
%
\multicolumn{9}{c}%
{{\bfseries Continued from previous page}} \\
\hline%
%
\textbf{} & \textbf{Reg. No.} & \multicolumn{1}{c|}{\textbf{Name}} &
\multicolumn{1}{c|}{\textbf{Category}} & \multicolumn{1}{c|}{\textbf{Group}} & \textbf{GATE} & \textbf{Sponsored}&\textbf{Department} &\textbf{Marks} \\ \hline\hline
\endhead
%
\hline \multicolumn{9}{|r|}{{Continued on next page}} \\ \hline
\endfoot
%
\hline
\multicolumn{9}{|r|}{{Concluded}} \\ \hline
\endlastfoot
}},%
end table=\end{longtable},
column type/.add={|}{},
every last column/.style={%
column type/.add={}{|}},
columns/Name/.style={column type=|p{3cm},string type},
columns/Department/.style={column type=|l,string type},
every head row/.style={%
before row=\hline,after row=\hline}
}%
%--------------------------------------------------------------------------
\pgfplotstablecreatecol[copy column from table={\markspgf}{[index] 1}] {marks} {\namespgf}
%
{\footnotesize
\pgfplotstabletypeset[skip first n=1,outfile=pgfplotstable.multirow.out,%write it to file
]{\namespgf} %%% skip first n=1 NOT WORKING????
} %%% How to tell pgfplotstable not to print the headers from the csv file?
% ----------------------------------------------------------------------%
\end{document}
Here is the output of this code:

Questions:
The first row is taken (by
pgfplots) from thenamespgf.csvfile which I do not want. How to tellpgfplotstablenot to print the header from file? (I give it myself as in code).How to move the
Markscolumn as fourth column next toNames?
Hope I am clear enough. If any more clarifications are needed please let me know.
