在 Windows 中编写脚本来创建 Excel 工作表
我有一个 txt 文件,其中包含需要输入到 Excel 的数据。
问题是我有几个这样的文件,我想为每个文件创建一个 Excel 文件。所以我想到了编写脚本。 谁能告诉我如何启动至少所需的工具和使用的语言
谢谢
编辑:原来命名扩展名.csv可以直接在excel中打开它。现在看看如何打开 .csv ,将格式更改为自动调整宽度,然后保存到 Excel
I have a txt file that contains data which I need to input to Excel.
The problem is I have several of those files and I want to create an excel file for each. So I was thinking of scripting.
Can anyone point me to how to start atleast the tool needed and language to use
Thanks
EDIT: turns out naming the extension .csv can directly open it in excel. Now looking on how to open .csv , change format to autofit width and then save to excel
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不直接编写 CSV 文件...它们可以在 Excel 上打开,并且不需要任何努力。
http://en.wikipedia.org/wiki/Comma-separated_values
Why don't you just write CSV files... They open on Excel and require no effort.
http://en.wikipedia.org/wiki/Comma-separated_values
当然。我碰巧非常喜欢 php 来完成此类任务,但大多数其他脚本语言都可以做到这一点。即:Python、Ruby ......等等。
PHP 附带许多用于 CSV 的内置函数。它也在 Windows 上运行良好,如果您需要在 'nux 环境上移植,它是跨平台的。该语言非常容易学习,对于您想要编写脚本的大多数内容都有大量的教程。
首先,如果您想破冰,有一个非常简单但有效的示例 此处,包含更多 php/excel 资源的链接。当然,如果你走这条路,谷歌上还有更多更多的例子等着你。
希望有帮助,祝你好运!
Of course. I have happen to enjoy php a lot for this type of task, but most any other scripting language is capable of this. Ie: Python, Ruby .. and many more.
PHP comes with many built-in functions for CSV. It also runs fine on windows, is cross-platform if you ever need to port on a 'nux environnement. The language is quite easy to learn, there are tons and tons of tutorials out there for most anything you want to script.
To get started, if you want to crack the ice there is a very simple but working example here, with links to more php/excel ressources. OF course, if you take this path, there are many many more examples waiting for you on google.
Hope that helps, good-luck!