Giter Site home page Giter Site logo

cicc_excel's Introduction

Install

pip install cicc_excel

How to Use

from cicc_excel.excelwriter import ExcelWriter

# create new writer
# default font is 宋体, Arial, Times New Roman
# to setup a percentage column, put a % in column name
# default col width will adjust by font_size
wb = ExcelWriter('export_file_name.xlsx', ch_font="中文字体", num_font="Number Font", en_font="English Font", first_row_color='#EEECE1', first_row_height=20, font_size=10)

#load data into writer in pandas dataframe
wb.load_data(df)

#set highlight columns by name
#color in #FFFFFF format
wb.set_hl_col_by_names('col_name', 'sheet_name', 'background_color', 'color')
wb.set_hl_col_by_names('col_name2', 'sheet_name', 'background_color2', 'color2')
#write dataframe to xlsx file
wb.write_data('sheet_name')

#hide cols
wb.hide_col(5,12,'sheet_name')

#collapse cols (have a + on top)
wb.collapse_col(5,12,'sheet_name')

#freeze cell
wb.freeze(1,4, 'sheet_name')

#set hightlight columns for another sheet
#default background color is yellow
wb.load_data(df2)
wb.set_hl_col_by_names('col_name', 'another_sheet_name')
wb.write_data('another_sheet_name')

#another sheet
wb.load_data(df3)
wb.write_data('last_sheet_name')

#save file
wb.save()

cicc_excel's People

Contributors

nyuspc avatar ruiqianli avatar

Stargazers

 avatar  avatar Alicia Zheng avatar

Watchers

 avatar Kostas Georgiou avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.