import pandas as pd

df = pd.read_csv('/sample.txt', header=None, skiprows=[0],skipfooter=1, delimiter = '|', names=["COL1","COL2","COL3"])

#ds = df.iloc[1:].iloc[:-1]

spark.createDataFrame(df.astype(str)).createOrReplaceTempView('BaseCode')