Jh. Park
Jh. Park

Reputation: 21

xlwings: how can I read all values when first cell is empty?

I am using xlwings and I have a problem.

my excel data looks like:
my excel data

Like above a image, My data has a empty value of first cell.

when I try to read that column...I have all NaN values...like below..

Resolution Type

 NaN 

 NaN 

 NaN 

 NaN 

This is my code..

sheet.range('G1').options(pd.DataFrame, index=False, expand='table', headers=True).value

I want to my original data..

what should I do?

Upvotes: 2

Views: 1583

Answers (1)

mouwsy
mouwsy

Reputation: 1933

use used_range:

import xlwings as xw

filepath = r"a_file.xlsx"

wb = xw.Book(filepath)
sheet = wb.sheets[0]

print(sheet.used_range)

Upvotes: 1

Related Questions