![]() |
Reading txt file into the buffer
I have a text file which is large and I am reading the file line by line. The
data has some values on each line and it is taking tooo long. I was wondering if I could load the file to the buffer or read it as one long string which would speed up the transfer into excel. The file has about 900,000 lines and I am reading about 40,000. The process I am using is reading each line then writing it to the excel spreadsheet. I didn't think it should take 15 minutes to do that. Please help with tips of reading a text file that can speed up my runs. Thank you in advance. |
Reading txt file into the buffer
Hi,
Is the data organized as a table? Do you need just 40,000 rows based on some criteria? If so, you could import the data in an MS Access db's table. Then run a query to isolate the rows you need and export the result to excel. -- Regards, Sébastien <http://www.ondemandanalysis.com "WannaBeExceller" wrote: I have a text file which is large and I am reading the file line by line. The data has some values on each line and it is taking tooo long. I was wondering if I could load the file to the buffer or read it as one long string which would speed up the transfer into excel. The file has about 900,000 lines and I am reading about 40,000. The process I am using is reading each line then writing it to the excel spreadsheet. I didn't think it should take 15 minutes to do that. Please help with tips of reading a text file that can speed up my runs. Thank you in advance. |
Reading txt file into the buffer
Based on what you have described you should be loading the data to a database
of some sort and then dealing with it from there. Excel is not really well suited to deal with 900,000 lines of input. Excel can interface with Access if you want to use Excel as your front end to deal with the data, via pivot tables or queries. You can post your code but I have strong doubts that we will be able to speed things up significantly. My only suggestion if the database thing is not an option would be to conect to the text file via ADO... Here is a link to help you with that if that is of interest to you. http://www.erlandsendata.no/english/...php?t=envbadac -- HTH... Jim Thomlinson "WannaBeExceller" wrote: I have a text file which is large and I am reading the file line by line. The data has some values on each line and it is taking tooo long. I was wondering if I could load the file to the buffer or read it as one long string which would speed up the transfer into excel. The file has about 900,000 lines and I am reading about 40,000. The process I am using is reading each line then writing it to the excel spreadsheet. I didn't think it should take 15 minutes to do that. Please help with tips of reading a text file that can speed up my runs. Thank you in advance. |
All times are GMT +1. The time now is 06:55 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com