我想将以文本格式的报告转换为XLSX文档。但是问题是文本文件中的数据有一些缺少的列值
typical report data is like this,
A simple approach that i wanted to follow was to use space as a delimeter but the data is not in a well structured manner
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是正确的,从文本到CSV的导出不是一个实际的开始,但是这对导入是有益的。因此,这是您的100%结构良好的源文本,可以将其保存到纯文本中。
这是excel
You are correct that export from text to csv is not a practical start, however it would be good for import. So here is your 100% well structured source text to be saved into plain text.
And here is the import to Excel
您可以使用Google镜头将数据从这张图片中获取,然后复制并粘贴到Excel文件。最简单的方法。
或首先将其转换为PDF,然后使用Google镜头。转到文件滚动以打印在打印设置中的打印选项,这是Microsoft打印到PDF选择的选项,然后按打印将要求您提供位置,然后给它并使用它
you can use google lens to get your data out of this picture then copy and paste to excel file. the easiest way.
or first convert this into pdf then use google lens. go to file scroll to print option in print setting their is an option of MICROSOFT PRINT TO PDF select that and press print it will ask you for location then give it and use it
读取文件的第一行,并通过检查是否有1个以上的空格来拆分每一列。除此之外,还可以计算每列的时间。
之后,您可以简单地浏览包含数据的其他行并提取信息,通过检查列的长度
(并且请不要将文本图像放入Stackoverflow,实际文本更好)
编辑:编辑:
Python实施:
read the first line of the file and split each column by checking if there is more than 1 whitespace. In addition to that you count how long each column is.
after that you can simply go through the other rows containing data and extract the information, by checking the length of the column you are at
(and please don't put images of text into stackoverflow, actual text is better)
EDIT:
python implementation: