×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Removing lines from csv to reduce size for Excel.

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.

Replies continue below

Recommended for you

RE: Removing lines from csv to reduce size for Excel.

I don't quite understand your problem. Is your file more than 65536 records long or does it simply have too much data?

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.

The problem is excel probably won't open a file that is too ridiculous in size.

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close