Skip to content

Commit

Permalink
Merge pull request #1507 from resilient-tech/mergify/bp/version-15-ho…
Browse files Browse the repository at this point in the history
…tfix/pr-1505

fix: limit exporter values to columns available (backport #1505)
  • Loading branch information
mergify[bot] authored Dec 29, 2023
2 parents ffd859b + 5f36f0b commit cdd12d2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion india_compliance/gst_india/utils/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ def add_data(self, data, **kwargs):

for row in self.parse_data(data):
for idx, val in enumerate(row, 1):
if idx > len(self.headers):
break

cell = self.ws.cell(row=self.row_dimension, column=idx)
self.apply_format(row=self.row_dimension, column=idx, **kwargs)
cell.value = val
Expand Down Expand Up @@ -311,6 +314,6 @@ def get_range(self, start_row, start_column, end_row, end_column, freeze=False):
def get_column_index(self, column_name):
"""Get column index / position from column name"""

for (idx, field) in enumerate(self.headers, 1):
for idx, field in enumerate(self.headers, 1):
if field["fieldname"] == column_name:
return idx

0 comments on commit cdd12d2

Please sign in to comment.