Skip to content

Commit

Permalink
added readMultipleSheets.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Aakash Sinha authored Feb 27, 2018
1 parent 77ecbfa commit 717de5f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions readMultipleSheets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 27 16:34:44 2018
@author: Aakash Sinha
"""

import pandas as pd

df = pd.read_excel('Schema_POData.xlsx')
# This will read the first sheet into df

xls = pd.ExcelFile('Schema_POData.xlsx')
# This will parse the excel sheet and it is useful when we are reading dataframes in loop

xls.sheet_names
# This will display all the sheet names present in the Excel Sheet

df = pd.read_excel('Schema_POData.xlsx', sheetname="POData")
# This will read sheet "POData" from the excel file

sheet_to_df_map = {}
for sheet_name in xls.sheet_names:
sheet_to_df_map[sheet_name] = xls.parse(sheet_name)
# This will read all the sheets to a map

0 comments on commit 717de5f

Please sign in to comment.