Verify if data starts and ends at specific cells in excel - Python

Viewed 22

I have an excel file where i want to verify if the data exactly starts at row A4 and ends at row A55. Below is the code I am working on:

    #I am skipping first 3 rows and processing 52 rows of which 1st row is header
    df = pd.read_excel(readxldata, skiprows=3,
                       sheet_name=sheetname, nrows=52)
    csv_buffer = []
    csv_buffer = StringIO()
    df.to_csv(csv_buffer)
    s3_resource.Object("mybucket", keypath+sheetname +
                      '.csv').put(Body=csv_buffer.getvalue())
    df1 = pd.read_csv("s3://mybucket/"+keypath+sheetname+".csv")

So I want to add additional validation that checks if the data starts at cell A4 and ends at cell A55. How to do that?

0 Answers
Related