Python | Convert an HTML table into excel Last Updated : 25 Jun, 2019 Comments Improve Suggest changes Like Article Like Report MS Excel is a powerful tool for handling huge amounts of tabular data. It can be particularly useful for sorting, analyzing, performing complex calculations and visualizing data. In this article, we will discuss how to extract a table from a webpage and store it in Excel format. Step #1: Converting to Pandas dataframe Pandas is a Python library used for managing tables. Our first step would be to store the table from the webpage into a Pandas dataframe. The function read_html() returns a list of dataframes, each element representing a table in the webpage. Here we are assuming that the webpage contains a single table. Python3 # Importing pandas import pandas as pd # The webpage URL whose table we want to extract url = "https://www.geeksforgeeks.org/extended-operators-in-relational-algebra/" # Assign the table data to a Pandas dataframe table = pd.read_html(url)[0] # Print the dataframe print(table) Output 0 1 2 3 4 0 ROLL_NO NAME ADDRESS PHONE AGE 1 1 RAM DELHI 9455123451 18 2 2 RAMESH GURGAON 9652431543 18 3 3 SUJIT ROHTAK 9156253131 20 4 4 SURESH DELHI 9156768971 18 Step #2: Storing the Pandas dataframe in an excel file For this, we use the to_excel() function of Pandas, passing the filename as a parameter. Python3 # Importing pandas import pandas as pd # The webpage URL whose table we want to extract url = "https://www.geeksforgeeks.org/extended-operators-in-relational-algebra/" # Assign the table data to a Pandas dataframe table = pd.read_html(url)[0] # Store the dataframe in Excel file table.to_excel("data.xlsx") Output: In case of multiple tables on the webpage, we can change the index number from 0 to that of the required table. Comment More infoAdvertise with us Next Article Python | Convert an HTML table into excel A Abhishek De Follow Improve Article Tags : Python Python-pandas Practice Tags : python Similar Reads Convert HTML table into CSV file in python CSV file is a Comma Separated Value file that uses a comma to separate values. CSV file is a useful thing in today's world when we are talking about machine learning, data handling, and data visualization. In this article, we will discuss how to convert an HTML table into a CSV file. Converting HTML 2 min read Convert CSV to HTML Table in Python CSV file is a Comma Separated Value file that uses a comma to separate values. It is basically used for exchanging data between different applications. In this, individual rows are separated by a newline. Fields of data in each row are delimited with a comma.Example :  Name, Salary, Age, No.of year 2 min read How to Convert JSON to Excel in Python JSON (JavaScript Object Notation) is a widely used data format that is both easy to read and write for humans and simple for machines to parse and generate. However, there may be times when we need to convert this JSON data into an Excel spreadsheet for analysis or reporting. In this article, we'll 3 min read Convert Excel to CSV in Python In this article, we will be dealing with the conversion of Excel (.xlsx) file into .csv.  There are two formats mostly used in Excel : (*.xlsx) : Excel Microsoft Office Open XML Format Spreadsheet file.(*.xls) : Excel Spreadsheet (Excel 97-2003 workbook). Let's Consider a dataset of a shopping store 3 min read Python Convert Html to PDF Convert HTML/webpage to PDF There are many websites that do not allow to download the content in form of pdf, they either ask to buy their premium version or don't have such download service in form of pdf. Conversion in 3 Steps from Webpage/HTML to PDF Step1: Download library pdfkit $ pip install p 1 min read How to Convert Excel to XML Format in Python? Python proves to be a powerful language when the requirement is to convert a file from one format to the other. It supports tools that can be employed to easily achieve the functionality. In this article, we'll find out how we will convert from an Excel file to Extensible terminology (XML) files wit 3 min read Convert XML to CSV in Python XML (Extensible Markup Language) is widely used to store and transport structured data. However, for tasks like data analysis or spreadsheet editing, CSV (Comma-Separated Values) is far more user-friendly and easier to work with.To make XML data easier to process, we often convert it to a CSV file. 2 min read How Can I Enable Python in Excel? Excel and Python are a dynamic combination that may help anyone improve their automation and data analysis skills. Not only can Python help you become more proficient with spreadsheets, but it can also revolutionize efficiency and insight. This is how to easily enable Python in Excel to open up a pl 3 min read How to Convert HTML to Markdown in Python? Markdown is a way of writing a formatted text on the web. This article discusses how an HTML text can be converted to Markdown. We can easily convert HTML to markdown using markdownify package. So let's see how to download markdownify package and convert our HTML to markdown in python. Installation 1 min read Convert Excel to PDF Using Python Python is a high-level, general-purpose, and very popular programming language. Python programming language (latest Python 3) is being used in web development, Machine Learning applications, along with all cutting-edge technology in Software Industry.In this article, we will learn how to convert an 1 min read Like