我怎样才能提取excel数据的列名?

我的Excel数据如下所示:

ABC 1 123 534 576 2 456 745 345 3 234 765 285 

在另一个Excel电子表格中,我的数据可能如下所示:

  BCA 1 123 534 576 2 456 745 345 3 234 765 285 

如何从两个电子表格中提取C列的内容?

我的代码如下:

 #Open the workbook ow = xlrd.open_workbook('export.xlsx').sheet_by_index(0) #Store column 3's data inside an array ips = ow.col_values(2, 1) 

我想更喜欢的东西: ips = ow.col_values(C, 1)

我怎样才能达到上述?

由于我有两个不同的电子表格,我想要的数据是在两个单独的行中,我必须按名称search第一行,直到find它,然后提取该列。

以下是我如何做到的:

 ow = xlrd.open_workbook('export.xlsx').sheet_by_index(0) for x in range (0, 20): try: if ow.cell_value(0, x) == "IP Address": print "found it!" ips = ow.col_values(x, 1) break except IndexError: continue