Is there a function to unhide columns in excel through python

0 votes

In order to maintain colour formatting, I turned an Excel spreadsheet into a DataFrame using StyleFrame. A few columns are already buried by default when I return to an Excel spreadsheet after converting this DataFrame.

This is my code:

import openpyxl
import pandas as pd
from StyleFrame import StyleFrame, Styler, utils  
sf = StyleFrame.read_excel("aaaa\\aaaa\\cdddd .xlsx",sheet_name = 2, read_style=True, header = None)
ew = StyleFrame.ExcelWriter('aaaa\\abbbbbb2.xlsx')
sf.to_excel(excel_writer = ew, header = False, index = False).save()

How do I make sure these columns are not hidden when opening the spreadsheet in Excel?

Oct 17 in Others by Kithuzzz
• 20,660 points
83 views

1 answer to this question.

0 votes

Excel file :

df.to_excel('demofile.xlsx',index=False)

import openpyxl

py = openpyxl.load_workbook('demofile.xlsx')
exlsheet = py.get_sheet_by_name('yoursheetName')

Checking Column

for col in exlsheet.columns:
  if not col[2].value:
    exlsheet.column_dimensions[col[2].column].hidden = True

Save your file

py.save('modifiedfile.xlsx')
answered Oct 18 by narikkadan
• 37,660 points

Related Questions In Others

0 votes
1 answer
0 votes
1 answer

Is there a way in Microsoft Excel to give specific bins different bin widths when making a histogram plot?

Excel built-in histogram tool only allows equal ...READ MORE

answered Oct 2 in Others by narikkadan
• 37,660 points
69 views
0 votes
1 answer

Is there a coalesce-like function in Excel?

To have Excel analyze the formula as ...READ MORE

answered Oct 21 in Others by narikkadan
• 37,660 points
131 views
0 votes
1 answer
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 3,149 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Is there a function in excel to find duplicates

Solution: You can use Conditional formatting inside the ...READ MORE

answered Nov 14 in Others by narikkadan
• 37,660 points
29 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP