Copy link to clipboard
Copied
I have a tab delimited file that was created from MS Excel. This tab delimited file has a number of rows and I am wanting to know how many rows are in this file utilizing javascript. Any sugesstions would be greatful. Thank you in advance.
Copy link to clipboard
Copied
What do you mean? A text file can't "utilize" JavaScript. It can contain JS code, but that's not executed unless the file is loaded into some other application. Also, it would be very difficult to identify such a thing.
Copy link to clipboard
Copied
Sorry, I think I misunderstood what you meant... You want to use JS to know how many lines are in the file, right?
If so, you can use the readFileIntoStream method of the util object and then parse it as a string to find that out.
One way would be to split it by new-line characters (either "\n" or "\r\n", depending on the encoding), and then check the length of the resulting array.
Copy link to clipboard
Copied
Thank you for you repsonse, I will look into what you have suggested. Is there a way to move to the beginning (first column) of the last line of the tab delimited file?