Skip to main content
Participant
April 20, 2023
Question

Tab Delimited File

  • April 20, 2023
  • 1 reply
  • 1074 views

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.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
April 20, 2023

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.

try67
Community Expert
Community Expert
April 20, 2023

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.

Participant
April 20, 2023

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?