python 3.x - Pandas XLSXwriter: open XLSX file and save with format -


problem description

excelwriter pandas capable of storing xlsx files defined formats, possible capture formats , keep them datafile well? so;

  1. open xlsx file , capture number/time/date/.. formats; then
  2. save file same formats, example number, dates , time formats.

examples of storing number formats can found here, , storing date , time formats can found here.

mwe

1 - open xlsx file , capture formats

import pandas pd datetime import datetime  # capture number/time/date/.. formats here? df = pandas.read_excel("sourcefile.xlsx")  

2 - save xlsx file same formats

writer = pd.excelwriter("targetfile.xlsx", engine='xlsxwriter') df.to_excel(writer, sheet_name='sheet1')  # set captured formats here  writer.save() 


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -