I have merged three external pdf files. Now I want to create table of contents of this resultant pdf file. Here \tablesofcontentsis not working.

\documentclass{article}
\usepackage{pdfpages}
\begin{document}

\includepdf[pages={1,2,3-30}]{myfile1.pdf}
\includepdf[pages={1,2,7-40}]{myfile2.pdf}
\includepdf[pages={990}]{myfile3.pdf}

\end{document}

-
Please (other have also asked you this) include your questions in the same place you place your code and not as a separate comment. – Gonzalo Medina Mar 22 at 17:39
Use \tableofcontents and addtotoc={<page number>,<section>,<level>,<heading>,<label>} in the optional argument of \includepdf. – Gonzalo Medina Mar 22 at 17:41
I have down-voted your question for the simple reason of politeness. Many comments have been made to you, without respond. Please respond so that we at least know whether there is a barrier of some sort that does not enable you to respond to our messages. Kind regards (please at me in the chat if anybody think I am wrong in doing this) – zeroth Mar 22 at 19:14