本文介绍了根据excel数据处理文件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过读取excel文件来处理文件的查找和替换。 excel文件的结构是这样的。
我尝试过:
这就是我的程序的结构。
I want to process find and replace on a file by reading the excel file. the excel file is structured this way.
What I have tried:
This is how my program is structured.
推荐答案
for each row in excel data table
open file(row[0]) for apppend
replace string(row[0]) with ...
// other replacements if any
close file
next row
当然,如果几行之间的文件相同,那么代码会不必要地打开和关闭同一个文件,这样你就可以根据需要进行优化。
Of course that code unnecessarily opens and closes the same file if the file is the same between several rows so you can optimize that if needed.
这篇关于根据excel数据处理文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!