Removing lines from csv to reduce size for Excel.
Removing lines from csv to reduce size for Excel.
(OP)
How could I delete every second line (or 2 in 3 lines etc..) from a csv file so as to reduce the size so excel could open the full file and analysis the info.?
Thank you for your help.
RE: Removing lines from csv to reduce size for Excel.
If the data is more than 65536 records long you are SOL you will have to go to a database. Excel will only handle 65536 by 256 number of cells.
If the problem is a data size problem Excel will page the information in and out of memory and also save the undo data (more memory). If you can wait through the swapping time you can load the file and then parse out the data you want. Another solution is again to use a database and import the data into a table and export the required data. A final solution is to use some programming language such as C++ write a program to read the data parse the required data and write another file with the required data.
Whenever you start dealing with a large dataset a database is a better solution than a spreadsheet.
RE: Removing lines from csv to reduce size for Excel.
Best bet is to either read the file into Word and save it as parts, then write a VBA macro to decimate each part, then read the decimated parts in (ugly) or else write a very straight forward qbasic program to decimate the entire csv file before even trying to read it into Excel.
Something along the lines of
OPEN "infile.csv" for input as #1
OPEN "Outfile.csv" for output as #2
Repeat
lineinput #1,s$
lineinput #1,s$
writeln #2,s$
until eof
close
end
or whatever the correct syntax is
Cheers
Greg Locock