In my azure data lake everyday I will receive any one of the below file (only the file extension will vary but the file name remains same).
File Name:
Receipts_currendate.xlsx(extension is in small letter) or Receipts_currentdate.XLSX(extension is in Caps letter).
In my databricks the current pyspark code reads a file from a data lake (through ADL mount)and is supported only for the file extension in Caps letter .but I need the code needs to support for the file extension with small letter as well .
Current code in databricks :
import os
from pyspark.sql.types import
from pyspark.sql.functions import
import pandas as pd
from datetime import date,datetime,timedelta
from pyspark.sql.window import Window
from pyspark.sql import SQLContext
currentdate=(date.today().strftime('%m_%d_%Y')) #Filepath='/dbfs'+var_raw_path+'Receipts/receipts_02_03_2021.XLSX' Filepath='/dbfs'+var_raw_path+'WFCReceipts/receipts_'+currentdate+'.XLSX'
df = pd.read_excel(Filepath,index_col=None,usecols=[*range(0, 9)])





