readXlsxFile.py

import xlrd
from DataCleaning.library.functions.changeDirectory import *

# read and return .xlfx/.XLFX file with file name: fname
def readXlsxFile(fname, wd = ""):
tempWD = os.getcwd()
if wd != "":
os.chdir(wd)
else:
development2Raw()
bk = xlrd.open_workbook(fname)
os.chdir(tempWD)
return bk

def readXlsxFileInExternal(fname):
tempWd = os.getcwd()
# development2External()
os.chdir("D:\DCG_PRF_Data_Team\DataCleaning\library\external")
bk = xlrd.open_workbook(fname)
# external2Development()
os.chdir(tempWd)
return bk
原文地址:https://www.cnblogs.com/zhulimin/p/15369491.html