#!/usr/bin/env python
# -*- coding:utf-8 -*-
# __author__ = "blzhu"
"""
python study
Date:2017
"""
from xlrd import open_workbook
import os
from os.path import join
from xlutils.copy import copy source = r"E:\python\pycharmwork\excel"
for root, dirs, files in os.walk(source):
for OneFileName in files:
if OneFileName.find('.xls') == -1:
continue
print('文档名称:')
print(OneFileName)
OneFullFileName = join(root, OneFileName)
print(OneFullFileName)
rb = open_workbook(OneFileName, formatting_info=True)
w = copy(rb)
# 修改第0行第2列为123
w.get_sheet(0).write(0, 2, 123)
w.save(OneFileName)
print('finished')