如何在一个单元格中取出一大段文本并插入回车符将其分成多个单元格?
因此,我正在准备将数据插入到 sqlite 数据库中。从历史上看,我已将其放入 Excel 中,不同单元格中的数据相当于我的 db 表中的不同行(通过 csv 导入)。
现在,我从网页中提取了大量文本,该文本仅位于一个单元格中,但我需要将文本分解为不同的单元格。如何插入回车符?或者有没有一种方法可以将数据发送到 Excel 中,并使用一个符号自动将其放入单独的单元格中?或者我可以制作自己的自定义 csv 文件吗?除了剪切我想要移动的文本之外,还有更有效的方法吗?
文本中的一些数字是唯一的并且不断增加,我可以用它们来插入某些内容,但我不知道该怎么做。
请帮忙!
So I am working on prepping my data for insertion into a sqlite db. Historically, I have put it into excel, and the data in different cells has equated to different rows in my db table (through csv importation).
So now I have a huge bit of text that I have pulled from a webpage which is just in one cell, but I need to break the text up into different cells. How can I insert a carriage return? Or is there a way I can send the data into excel with a symbol that will automatically put it into separate cells? Or could I possibly make my own custom csv file? Aside from cutting the text I want to move, is there a more efficient way?
There are numbers that are in the text that are unique and increasing that I could use to insert something, but I can't figure out how to do it.
Please help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
10 步解决方案...
您还可以选择使用公式来执行后者:
=SUBSTITUTE(A1,"
<— 在此处插入 ALT+ENTER 以在引号之间进行硬回车","#")
这样您就不会意外地跳过任何硬返回(转换向导会卡住它们)。
A 10 step solution…
You can also choose to do the latter with a formula:
=SUBSTITUTE(A1,"
<— insert ALT+ENTER here for a hard return between the quotes","#")
This way you will not accidentally skip any hard returns (the conversion wizard chokes on them).
您还可以操作 CSV 文件,而不是在 Excel 中工作。只需尊重 CSV 基础知识,您应该能够(进行一些实验,然后)完成工作:
CSV 文件以分隔数据格式保存逗号分隔值,其中字段/列由逗号字符分隔和由换行符终止的记录/行。
包含特殊字符(逗号、换行符或双引号)的字段必须用双引号括起来,然后将任何现有双引号加倍(以转义它们)。
因此,如果您看一下中的巨大单元格CSV 格式(只需使用任何纯文本编辑器),它可能跨越几行并用双引号括起来,就像这样?
您可以将一个带引号的多行文本拆分为多个带引号的单行文本,如下所示:
Instead of working in Excel, you can also manipulate the CSV file. Just respect the CSV basics and you should be able to (experiment a little and then) get the job done:
A CSV file holds Comma-Separated Values, in a delimited data format that has fields/columns separated by the comma character and records/rows terminated by newlines.
Fields that contain a special character (comma, newline, or double quote), must be enclosed in double quotes, after doubling any existing double quotes (to escape those).
So if you take a look a the huge cell in CSV format (just use any plain text editor), it probably spans several lines and is enclosed in double quotes, like this?
You can split up that one quoted multiline text into e.g. several quote single lines of text, such as shown below: