Skip to content

Instantly share code, notes, and snippets.

@kakakaya
Created March 16, 2017 00:49
Show Gist options
  • Save kakakaya/ba6522d5a27703429b16da4a2e29079d to your computer and use it in GitHub Desktop.
Save kakakaya/ba6522d5a27703429b16da4a2e29079d to your computer and use it in GitHub Desktop.
Excelシートのセル名をPythonで取得する
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Author: kakakaya, Date: Thu Mar 16 09:35:47 2017
import openpyxl as px
def main():
wb = px.load_workbook("sheet_with_cell_name.xlsx")
defined_names = wb.defined_names.definedName
for defined_name in defined_names:
for d in defined_name.destinations:
print("Sheet name: {}, location: {}".format(d[0], d[1]))
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment