Skip to content

Instantly share code, notes, and snippets.

@st4lk
Created October 23, 2012 11:30
Show Gist options
  • Save st4lk/3938290 to your computer and use it in GitHub Desktop.
Save st4lk/3938290 to your computer and use it in GitHub Desktop.
Python: Save excel workbook copy
from xlrd import open_workbook
from xlutils.copy import copy
def save_workbook_copy(file_from, file_to):
rb = open_workbook(file_from, formatting_info=True)
wb = copy(rb) # a writable copy (I can't read values out of this, only write to it)
w_sheet = wb.get_sheet(0) # the sheet to write to within the writable copy
row_index = 0
col_index = 0
w_sheet.write(row_index, col_index,'DataToBeWritten')
wb.save(file_to)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment