0

I have few column names defined in my choices and I am adding it to the sheet as a first row but, one of the column should not be present all the time, it should vary conditionally, so I want to add a specific column based on some condition.

Here is my code sheet.add_row choices, style: style_shout

NOW, How should I add a column to the sheet?

  • If the first example on the project page doesn't help please clarify why. https://github.com/randym/axlsx/blob/master/examples – sayth Feb 08 '17 at 09:55

1 Answers1

0

try something like this:

adding first row with column names, then second row with column values

sheet.add_row ['col 1', 'col 2', 'col 3', 'col 4', 'col5']
sheet.add_row [1, 2, 0.3, 4, 5.0]

and depending on the conditions you want you can modify as required, for example:

  #Hide the 5th column
  sheet.column_info[4].hidden = true

you could encapsulate this within a condition to hide or display a column

Gurmukh Singh
  • 1,875
  • 3
  • 24
  • 62