如何在excel工作表中获取excel单元格的左上角和右下角



我想在Excel工作表区域中找到左上角单元格和右下角单元格,这是工作表中所有已占用单元格的边界框,来自win 7上的ironpython 2.7.5。

我的代码:

 from Microsoft.Office.Interop import Excel
 from System import Type
 excel = Excel.ApplicationClass()
 workbook = excel.Workbooks.Open(excelFilename, False, True)
 allWorksheets = workbook.WorkSheets
 for aWorkSheet in allWorksheets:
      last = aWs.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell, Type.Missing);
      range = excel.get_Range("A1", last);
      print "a worksheet range is " + str(range)

我需要在"范围"中找到左上角单元格和右下角单元格的链接

使用C#编程获取最后一个填充的excel行

如何在excel表格中获取占用单元格的范围

帮不了我。

有什么建议吗?感谢

使用.Value可以获得如下范围:

 ws.Range("A3:B4").Value = "A3:B4"

如ranges_and_offsets.py示例的第11行所示。

最新更新