vbscript - Read CSV File By Line in ASP -
I am trying to read a CSV file with VBScript and it is causing big problems because it does not recognize a line break. The way I have it now:
set objFSO = CreateObject ( "Scripting.FileSystemObject") to objFile = objFSO.OpenTextFile (server.mappath ( "my_csv_file.csv"), ForReading) until reading objFile.AtEndOfStream strline = objFile.ReadLine arrFields = Split (strLine, ",") LOOP_STUFF_HERE loop There are several lines in the CSV file but the problem is that the CSV file Is in the form of a line and the last item of each line is being added to the first item of the next line because there is no comma after the previous line Land (it has been made by a customer of mine in Excel and then sent me). My solution is that I have to open it in a text editor, manually add a comma at the end of the lines and then remove the line break. This will not work for a long time because we are installing an automated system.
In fact, I should be able to Split lines to a line break (I 'Split' (Strel, "\ n" tried , But this does not seem to work) and once again, when they are divided by line breaks, they divide them by commas. This is a multi-dimensional array in other words. Do not know how VBScript is to recognize line breaks, though some ideas? Help you Thanks to the area.
filesystem object Find again, ASP you are really different and proven methods to do. the easiest way to do this OLEDB jet or OLEDB ACE The file is being used to read Basically you need to create a OLEDB.Connection in the CSV to get all the data in the form of lines Specific
Comments
Post a Comment