将XLS值复制到包含内容的文本文件中

时间:2022-05-12 06:34:52

I have an existing text file created in a certain format, so that my VBS program can read it and use the file as a data store to validate the similar values in my application.

我有一个以某种格式创建的现有文本文件,以便我的VBS程序可以读取它并将该文件用作数据存储来验证我的应用程序中的类似值。

I now wish to update this text file, from an XLS sheet, so that the text (which is tab separated), is not disturbed, but the individual values within it can be changed as corresponding to the XLS sheet.

我现在希望从XLS工作表更新此文本文件,以便文本(分隔符分隔)不受干扰,但其中的各个值可以更改为对应于XLS工作表。

Is there a way to accomplish this with VBS itself or using powershell / python on windows systems? I do not have access to a UNIX box, hence unable to use the sed-awk tools for doing this and also the *NIX tools will not be able to read a XLS file.

有没有办法用VBS本身或在Windows系统上使用powershell / python来实现这一点?我无法访问UNIX框,因此无法使用sed-awk工具执行此操作,* NIX工具也无法读取XLS文件。

1 个解决方案

#1


1  

The textstream object does not support to insert text. To do this in vbscript you have to read the text file, store it into an array, update the array (supposedly you have corresponding unique key fields) and write the complete text file from the array.

textstream对象不支持插入文本。要在vbscript中执行此操作,您必须读取文本文件,将其存储到数组中,更新数组(假设您有相应的唯一键字段)并从数组中写入完整的文本文件。

#1


1  

The textstream object does not support to insert text. To do this in vbscript you have to read the text file, store it into an array, update the array (supposedly you have corresponding unique key fields) and write the complete text file from the array.

textstream对象不支持插入文本。要在vbscript中执行此操作,您必须读取文本文件,将其存储到数组中,更新数组(假设您有相应的唯一键字段)并从数组中写入完整的文本文件。