This article mainly introduces the C # implementation of the TXT text data quickly read to Excel, this article directly to show example code, need friends can refer to the next
Today, the implementation of a function, the TXT data to the Excel table, as a data source for MATLAB. Collect some C # operation Excel programs. The steps are as follows:
Download a Microsoft.Office.Interop.Excel.dll reference in the project.
Write the code as follows:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 The |
|
The above code can realize the function, because the data in TXT has 60501 rows, the amount of data is too large. I calculated that it would take about 2-3 minutes to go to excel with the above code. I want to transfer 9 txt altogether. It will take more than 20 minutes altogether. Such a system is obviously intolerable. Then find the data, found that using the rang method can improve the rate. It takes only about 3-4 seconds to increase the efficiency by dozens of times times. The code is as follows:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 The |
|