There are actually two ways to add a table of contents to a document in Google Docs. Both of these ways require that you create headings and subheadings in your document. The first way is through using Google Docs' built-in feature which can be accessed by clicking on "insert" button then select "table of contents". Watch this excellent tutorial from Shannon Hermandez to learn more about how to create a table of content using Google Docs built-in functionality.