how do i pass variables to the usecols of pdreadexcel?

You can simply create a string and pass it as an argument like this:

from_col = 'A'
w_l = f"{from_col}:{to_col}"  # 'A:O'
df = pd.read_excel(filepath, usecols=w_l)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top