Maybe I missunderstood the task, but this seems to be no problem:

\documentclass{article}
\usepackage{pgfplotstable}
\pgfplotsset{compat=newest}
\begin{document}
\section{Example-Table with unknown / random Number of Columns and Rows}
\subsection{Raw Data}
\pgfmathsetmacro\xrand{random(3, 7)}
\pgfmathsetmacro\yrand{random(5, 11)}
\xrand\, colums and \yrand\, rows.
\newwrite\mytable
\immediate\openout\mytable=\jobname-table.txt%
\newcommand{\row}{}% reserv Name
\foreach \Y in {1,...,\yrand}{%%%
\let\row=\empty% create List
\foreach \X in {1,...,\xrand}{%%
\pgfmathparse{\Y}
\ifx\empty\row{} \xdef\row{\pgfmathresult}%
\else \xdef\row{\row,\pgfmathresult}%
\fi
}%%
\noindent\row \\ % show
\immediate\write\mytable{\row}% save
}%%%
\immediate\closeout\mytable
%Test: \pgfplotstabletypeset[string type, col sep=comma]{\jobname-table.txt}
\subsection{Add a new Column}
\pgfplotstableset{create on use/NewCol/.style={
create col/set list={a,b,c,d},
},
columns/NewCol/.style={string type},
}
\pgfmathsetmacro\Xrand{\xrand-1}
\pgfplotstabletypeset[col sep=comma,
columns={NewCol,0,1,...,\Xrand},
empty cells with={---},
every head row/.style={after row=\hline}
]{\jobname-table.txt}
\end{document}
Note, that the part \newwrite\mytable .......
has nothing to do with the problem itself. It is only a "sophisticated" method of creating an arbitrary table with an unknown or random number of rows and columns.