Example 1: pandas read excel
import pandas as pd
pd.read_excel('tmp.xlsx’, sheet_name='Sheet1')
Example 2: pandas read excel
import pandas as pd
pd.read_excel('tmp.xlsx', index_col=0)
Example 3: read excel into dataframe python
import pandas as pd
sheet1, sheet2 = None, None
with pd.ExcelFile("PATH\FileName.xlsx") as reader:
sheet1 = pd.read_excel(reader, sheet_name='Sheet1')
sheet2 = pd.read_excel(reader, sheet_name='Sheet2')
Example 4: pandas read from excel
import pandas as pd
pandas.read_excel(io, sheet_name=0, header=0, names=None,
index_col=None, usecols=None,
squeeze=False, dtype=None, engine=None,
converters=None, true_values=None,
false_values=None, skiprows=None,
nrows=None, na_values=None,
keep_default_na=True, verbose=False,
parse_dates=False, date_parser=None,
thousands=None, comment=None,
skipfooter=0, convert_float=True,
mangle_dupe_cols=True, **kwds)
pd.read_excel('tmp.xlsx', index_col=0)
Example 5: read excel file using pandas in python
import sqlite3
import pandas as pd
from sqlalchemy import create_engine
file = "location of Excel file..."
engine = create_engine('sqlite://', echo=False)
df = pd.read_excel(file, sheet_name=sheetname)
df.to_sql("test", engine, if_exists="replace", index=False)
results = engine.execute("Select * from test")
final = pd.DataFrame(results, columns=df.columns)