8000 ENH: Added autofilter parameter to Excel output for both xlsxwriter and openpyxl engines by Upabjojr · Pull Request #42560 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

ENH: Added autofilter parameter to Excel output for both xlsxwriter and openpyxl engines #42560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
code reformatted
  • Loading branch information
Upabjojr committed Jul 19, 2021
commit ca13d2e262e8f05575a678d0a6e5cec5a0d0a03c
9 changes: 7 additions & 2 deletions pandas/io/excel/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,8 +871,13 @@ def engine(self):

@abc.abstractmethod
def write_cells(
self, cells, sheet_name=None, startrow=0, startcol=0,
freeze_panes=None, autofilter=None
self,
cells,
sheet_name=None,
startrow=0,
startcol=0,
freeze_panes=None,
autofilter=None,
):
"""
Write given formatted cells into Excel an excel sheet
Expand Down
10 changes: 8 additions & 2 deletions pandas/io/excel/_openpyxl.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,13 @@ def _convert_to_protection(cls, protection_dict):
return Protection(**protection_dict)

def write_cells(
self, cells, sheet_name=None, startrow=0, startcol=0,
freeze_panes=None, autofilter=False
self,
cells,
sheet_name=None,
startrow=0,
startcol=0,
freeze_panes=None,
autofilter=False,
):
# Write the frame cells using openpyxl.
sheet_name = self._get_sheet_name(sheet_name)
Expand Down Expand Up @@ -512,6 +517,7 @@ def write_cells(

if autofilter:
from openpyxl.utils import get_column_letter

wks.auto_filter.ref = "A1:" + get_column_letter(max_col + 1) + str(max_row)


Expand Down
9 changes: 7 additions & 2 deletions pandas/io/excel/_xlsxwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,13 @@ def save(self):
return self.book.close()

def write_cells(
self, cells, sheet_name=None, startrow=0, startcol=0, freeze_panes=None,
autofilter=False
self,
cells,
sheet_name=None,
startrow=0,
startcol=0,
freeze_panes=None,
autofilter=False,
):
# Write the frame cells using xlsxwriter.
sheet_name = self._get_sheet_name(sheet_name)
Expand Down
9 changes: 7 additions & 2 deletions pandas/io/excel/_xlwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,13 @@ def save(self):
self.book.save(self.handles.handle)

def write_cells(
self, cells, sheet_name=None, startrow=0, startcol=0,
freeze_panes=None, autofilter=False,
self,
cells,
sheet_name=None,
startrow=0,
startcol=0,
freeze_panes=None,
autofilter=False,
):

sheet_name = self._get_sheet_name(sheet_name)
Expand Down
0