Binary Search
| If you need to extract data from Excel files/sheets, this can be carried out with ActiveX and Javascript. Excel needs to be on the system (PC) on which the program is running. First, a short example of how to extract a single sheet, the first one, from a single .xls file: function GetXLS(fromName,toName){ If you call the above function many times in order to read a number of sheets, you will note that considerable time is taken. This is because Excel is loaded each time. To obviate this, you need to minimise opening Excel. The following example shows how to extract data from two .xls files. Each file has several sheets, of which four have data we need. Note, for clarity, the file paths are not shown in the code below. //Declare an input Array: //Declare an output Array: //Each sheet is read and saved as a .csv file. This is then read into an array by GetPlainData() - see Read/Write .csv files var wb=xl.ActiveWorkBook.WorkSheets(fsNames[0][1]); xl.ActiveWorkbook.Close; // close the first file The data from the four sheets from two files is now in the outNames files. These can be read by GetPlainData(), and can be manipulated as desired. Note: one can read Excel directly into arrays, but, unless one knows the structure of each sheet, one has to use large multidimensional arrays, which will take time to fill. For most purposes, the .csv file saving will be beneficial, in any event. |
|