Skip to content

Instantly share code, notes, and snippets.

@TimurNurlygayanov
Created September 17, 2019 07:33
Show Gist options
  • Save TimurNurlygayanov/781c1885f0e975e3bb2884a527b5de68 to your computer and use it in GitHub Desktop.
Save TimurNurlygayanov/781c1885f0e975e3bb2884a527b5de68 to your computer and use it in GitHub Desktop.
from openpyxl import load_workbook
data_file = '111.xlsx'
wb = load_workbook(filename=data_file)
data = wb['исходные']
filial_number = '01'
i = 2
while filial_number:
cell = 'F{0}'.format(i)
value = ("=IFS(E{0}='списки'!A$2, 'списки'!B$2, E{0}='списки'!A$3, "
"'списки'!B$3, E{0}='списки'!A$4, 'списки'!B$4)")
data[cell] = value.format(i)
i += 1
filial_number = data['E{0}'.format(i)].value
wb.save(data_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment