0

I have an excel which has 100 columns, but has data till a specific column only. (it is a monthly file and data gets appended to the file every month at the end in the column name which is month name.

How to I select that specific column which has recently populated data.

This is the following piece of code that i used to get the last column, but it returns the 100th column, which for obvious reasons, is empty

   workbook = load_workbook(filename=Input_directory + '\\' +File_name)  
   worksheet = workbook.active
   worksheet.max_column

Is there any way where i can get the column value of the excel till which it has data.

Thanks

  • What if you drop all empty columns instantly right after you import your dataframe? See [this](https://stackoverflow.com/a/51794989/9758194) – JvdV May 25 '20 at 13:01
  • That can be a workaround, but i would not like to load the whole excel at first place – Anindya Patowary May 25 '20 at 13:23

0 Answers0