CSV文件导入 [英] CSV File Import
问题描述
早上好,
我有一个问题,我将大型CSV导入Visual Studio 2005
- Visual Basic;一如既往,CSV的创建者已经在最终文件中包含了数据的详细信息(来自
开头的约160万条记录)。在我进行输入之前我正在对文件进行一些评估,目前这是通过读取所有行来完成的,直到
我到达最后然后返回最后10等行;有没有人知道
我怎么能从文件的底部读取,以便在我能够获得所需的数据之前否定读取过程的160万个b $ b周期。
我们非常感谢您提供的任何帮助。
您诚挚的,
William Foster
***通过开发人员指南 http: //www.developersdex.com ***
Good morning all,
I have an issue where I am importing a large CSV into Visual Studio 2005
- Visual Basic; as always the creators of the CSV have included the
details of the data at the end file (Some 1.6 million records from the
beginning). I am doing some evaluation on the file before I undertake
the importation, currently this is being done by reading all rows until
I get to the end then returning the last 10 or so rows; does anyone know
how I can read from the bottom of the file up to negate the 1.6 million
cycles of the read procedure before I can get to the data I need.
Any assistance you may be able to provide would be greatly appreciated.
Yours sincerely,
William Foster
*** Sent via Developersdex http://www.developersdex.com ***
推荐答案
William Foster写道:
William Foster wrote:
早上好,
我有一个问题,我将大型CSV导入Visual Studio 2005
- Visual Basic;一如既往,CSV的创建者已经在最终文件中包含了数据的详细信息(从
开始的约160万条记录)。在我进行输入之前,我正在对文件进行一些评估,目前这是通过读取所有行来完成的,直到
我到达最后然后返回最后10行左右;有没有人知道我怎么能从文件的底部读取,以便在我能够获得所需的数据之前否定160万次读取过程的周期。
非常感谢您提供的任何帮助。
您诚挚的,
William Foster
***通过Developersdex发送 http://www.developersdex.com ***
可能有一种更简单的方法,但我之前已经完成了这项工作,首先在二进制模式下打开文件
,因为CSV文件通常是行分隔的<通过CrLf(Hex 0D 0A)字符获得
,我从获取文件长度开始,然后向后读取
(使用SEEK)查找倒数第二个CrLf。
在倒数第二个和最后一个CrLf之间将是您的标题
您正在寻找的信息。
我相信这个虽然如前所述,也许有所帮助别人有一个
更好的方式。
ShaneO
有10种人 - 那些懂的人二元和那些
不要。
There''s probably a simpler way, but I''ve done it before by first opening
the file in Binary mode, and as CSV files are generally line-delimited
by CrLf (Hex 0D 0A) characters, I start by obtaining the file length and
reading backwards (using SEEK) to find the second-last CrLf.
Between the second-last and the last CrLf would be your header
information you were looking for.
I trust this helps, although as already said, maybe someone else has a
better way.
ShaneO
There are 10 kinds of people - Those who understand Binary and those who
don''t.
" William Foster" <无**** @ devdex.com>在留言中写道
新闻:%2 *************** @ TK2MSFTNGP12.phx.gbl ...
"William Foster" <no****@devdex.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
早上好,
我有一个问题,我将大型CSV导入Visual Studio 2005
- Visual Basic;一如既往,CSV的创建者已经在最终文件中包含了数据的详细信息(从
开始的约160万条记录)。在我进行输入之前,我正在对文件进行一些评估,目前这是通过读取所有行来完成的,直到
我到达最后然后返回最后10行左右;有没有人知道我怎么能从文件的底部读取,以便在我得到我需要的数据之前否定读取过程的160万个周期。
Good morning all,
I have an issue where I am importing a large CSV into Visual Studio 2005
- Visual Basic; as always the creators of the CSV have included the
details of the data at the end file (Some 1.6 million records from the
beginning). I am doing some evaluation on the file before I undertake
the importation, currently this is being done by reading all rows until
I get to the end then returning the last 10 or so rows; does anyone know
how I can read from the bottom of the file up to negate the 1.6 million
cycles of the read procedure before I can get to the data I need.
您是否尝试过MSWord?
Have you tried MSWord?
Shane,
感谢您的协助,我会给予那个去吧,听起来有点尴尬,但它比我做的好多了。
谢谢!
你真诚的,
William Foster
***通过Developersdex发送 http://www.developersdex.com ***
Shane,
Thanks for your assistance, I will give that a go, it sounds a bit
awkward, but it is much better than the way I am doing it.
Thank you !
Yours sincerely,
William Foster
*** Sent via Developersdex http://www.developersdex.com ***
这篇关于CSV文件导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!