Open your Google Docs document
Place the cursor where you want the table of contents
Click Insert
Select Table of contents
Choose a format
Apply heading styles to your document headings using the Styles menu
Click the table of contents to update it after making changes
