A Simple Loop
First of all I would read the table once using \pgfplotstableread into a macro and reuse this macro. This speeds up the typesetting and saves you some typing in the case that the location, name, or format of the file changes.
\pgfplotstableread[col sep=comma]{index.dat}\loadedtable
Since you are doing exactly the same thing for each column, viz. plotting and adding the column name to the legend, I would suggest to just loop over all the columns.
\pgfplotsinvokeforeach{0-19 years,20-39 years,40-59 years,60-79 years,80-99 years,100 years+}{
\addplot table [x=Year, y=#1, col sep=comma] {\loadedtable};
\addlegendentry{#1}
}
Caution! You have to use either \pgfplotsungroupedforeach or \pgfplotsinvokeforeach here. The classic TikZ \foreach will not work straightforwardly.
You have only provided the first two samples of data, which is why the output looks a little bit ridiculous.
\documentclass{article}
\begin{filecontents*}{index.dat}
Year,0-19 years,20-39 years,40-59 years,60-79 years,80-99 years,100 years+
2000,100,100,100,100,100,100
2001,101,102,101,102,101,102
\end{filecontents*}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=\textwidth,
height=0.5\textwidth,
grid=both,
xmin=2000,
xmax=2010,
xticklabel style={/pgf/number format/1000 sep=, rotate=45},
ymin=80,
]
\pgfplotstableread[col sep=comma]{index.dat}\loadedtable
\pgfplotsinvokeforeach{0-19 years,20-39 years,40-59 years,60-79 years,80-99 years,100 years+}{
\addplot table [x=Year, y=#1] {\loadedtable};
\addlegendentry{#1}
}
\end{axis}
\end{tikzpicture}
\end{document}

More than One Loop Variable
If you additionally want to assign a certain style (color, mark, etc.) to the plots in the loop, you will have to use \foreach, because \pgfplotsinvokeforeach allows only a single variable. The downside is that in contrast to \pgfplotsinvokeforeach, where #1 is simply replaced by the content of the loop variable, for \foreach you have to explicitly expand the loop variable in an \edef context (That is the pitfall with \foreach I was referring to above). The loop hence transforms to
\foreach \col/\style in {%
0-19 years/{red,dashed,mark options={red}},
20-39 years/{blue},
40-59 years/{green},
60-79 years/{yellow},
80-99 years/{magenta},
100 years+/{cyan}
} {
\edef\temp{%
\noexpand\addplot+[\style] table [x=Year, y=\col] {\noexpand\loadedtable};
\noexpand\addlegendentry{\col}
}
\temp
}
The full example is then
\documentclass{article}
\begin{filecontents*}{index.dat}
Year,0-19 years,20-39 years,40-59 years,60-79 years,80-99 years,100 years+
2000,100,100,100,100,100,100
2001,101,102,101,102,101,102
\end{filecontents*}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=\textwidth,
height=0.5\textwidth,
grid=both,
xmin=2000,
xmax=2010,
xticklabel style={/pgf/number format/1000 sep=, rotate=45},
ymin=80,
]
\pgfplotstableread[col sep=comma]{index.dat}\loadedtable
\foreach \col/\style in {%
0-19 years/{red,dashed,mark options={red}},
20-39 years/{blue},
40-59 years/{green},
60-79 years/{yellow},
80-99 years/{magenta},
100 years+/{cyan}
} {
\edef\temp{%
\noexpand\addplot+[\style] table [x=Year, y=\col] {\noexpand\loadedtable};
\noexpand\addlegendentry{\col}
}
\temp
}
\end{axis}
\end{tikzpicture}
\end{document}

Cycle Lists
Another viable alternative (which I would favour) is creating a custom cycle list for colours. In a cycle list, pgfplots picks the next entry automatically on each plot and repeats, when the list has reached its end. To define a cycle list use
\pgfplotscreateplotcyclelist{custom}{%
red,mark=*\\blue,mark=square*\\green,mark=otimes*\\%
yellow,mark=star\\magenta,mark=diamond*\\cyan,mark=*\\%
}
The entries in the cycle list are delimited by \\. It is important to hide the linebreak after \\ with a %. In an entry you can specify colours, marks, and other options, such as linestyles. For this example I went with colours and marks. After defining the cycle list (before the axis environment) you have to tell the axis to actually use it by adding cycle list name=custom to the options.
\documentclass{article}
\begin{filecontents*}{index.dat}
Year,0-19 years,20-39 years,40-59 years,60-79 years,80-99 years,100 years+
2000,100,100,100,100,100,100
2001,101,102,101,102,101,102
\end{filecontents*}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\pgfplotscreateplotcyclelist{custom}{%
red,mark=*\\blue,mark=square*\\green,mark=otimes*\\%
yellow,mark=star\\magenta,mark=diamond*\\cyan,mark=*\\%
}
\begin{axis}[
width=\textwidth,
height=0.5\textwidth,
grid=both,
xmin=2000,
xmax=2010,
xticklabel style={/pgf/number format/1000 sep=, rotate=45},
ymin=80,
cycle list name=custom
]
\pgfplotstableread[col sep=comma]{index.dat}\loadedtable
\pgfplotsinvokeforeach{0-19 years,20-39 years,40-59 years,60-79 years,80-99 years,100 years+}{
\addplot table [x=Year, y=#1] {\loadedtable};
\addlegendentry{#1}
}
\end{axis}
\end{tikzpicture}
\end{document}
