1

I have a very large CSV file which I should analyze. It's too big so I can't even open it in Excel or Stata. So I want to take first few rows of it and explore the data, and then select necessary columns.

What I need it a software which take specific rows or columns of a csv file and output it as a separate file. (e.g. I want to take Row 1~2500 or Column A,B,C and E) Which can do this?

1

Use PowerShell.

PS > get-content \Large.csv -totalcount 2500 > Output.txt

enter image description here

You put \Large.csv as the Path to your Csv.

You put Output.txt as where you want the output to go say C:/Usere/Documents/Output.txt

enter image description here

4
  • You've only answer half the question. "I want to take ... Column A,B,C and E"
    – DavidPostill
    Apr 20 '16 at 10:34
  • @DavidPostill He said he wanted to either Take row 1-2500 or Columns like A,B,C and E? So I answered for pulling from row 2500 to a text file. Apr 20 '16 at 10:36
  • Yes. I understand. But his question was in two parts.
    – DavidPostill
    Apr 20 '16 at 10:37
  • I see. He could take the .txt off and put it to csv then select the columns he wants. Apr 20 '16 at 10:39
1

You may try the free Microsoft Add-In Power Query (from Excel 2010) or rather the open source R statistical software .

The first is quite intuitive for Loading and transforming your data for several source types. However the ouptut will be as a table in Excel or in the data model (Power Pivot feature). With VBA there is however a way to produce a CSV, s. Blogpost from Kasper de Jonge.

R is probably also suitable to subset your datas or later produce an output CSV file. First hints here or on Stackoverflow.

1

I'd suggest you look at TextQ (disclaimer - I'm its developer). It can import a big CSV file and lets you view and query it.

You can query via a UI Query Builder or SQL, which supports limit and offset parameters. Then you can export any query to a CSV file, which can be imported in MS Excel or others.

Here is a video demo and more detailed tutorial.

You can get it from the Mac App Store or Microsoft Store (coming soon).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.