# Write data into existing '.xlsx' file that has multiple sheets

**URL:** <https://community.unix.com/t/write-data-into-existing-xlsx-file-that-has-multiple-sheets/366841>\
**Category:** Shell Programming and Scripting\
**Created:** [June 1, 2017, 4:55am UTC](https://community.unix.com/t/write-data-into-existing-xlsx-file-that-has-multiple-sheets/366841 "2017-06-01T04:55:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nans](https://community.unix.com/letter_avatar/nans/32/6_449c533f586939b6e5f246632a46421f.png) [@nans](https://community.unix.com/u/nans)\
**Post date:** [June 1, 2017, 4:55am UTC](https://community.unix.com/t/write-data-into-existing-xlsx-file-that-has-multiple-sheets/366841/1 "2017-06-01T04:55:02Z")

</div>

Hello,  
I have a .xlsx file with 11 worksheets and I need to insert the contents of a text file (tab delim, roughly 30 columns with 1000 rows) from Row 3 onwards on the 2nd sheet. I have my code which can insert values into existing sheet but I am unable to write/import the contents of a text file. Also, is there a way to maintain the font/images/color of the original xlsx file in the new saved file ?

```nohighlight
#!/usr/bin/env python  
from openpyxl.reader.excel import load_workbook  

wb=load_workbook(r'excel.xlsx') 

ws=wb.get_sheet_by_name('Sheet2') 

ws.cell('A3').value = 'new value' 

wb.save(r'S12a.xlsx')

```

thank you
