To export the sitemap to excel you need to execute a df.to_csv function by appending the directory path where you want to store the sitemap on your PC. sitemap_url_df.to_csv(r'YOUR-PATH-DIRECTORY.csv'), index = False, header=True) You need to append and execute this command prompt right after the lines of code pointing at the sitemap scraping. Please note that we are using "sitemap_url" as the custom name of the function.