Click here to Skip to main content
14,774,516 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi I have a large .csv file with more than 2 million rows which I needed to import in excel sheet by sheet in a sequential manner like suppose the maximum limit of rows in one excel sheet is 1,048,576 so in the next sheet I should start importing the rows next to the maximum limit and so on in different sheets. So please help me in importing the .csv data in excel.

What I have tried:

I have not tried anything except googling which gives the option by pivot query method. This method loads the data but not efficient to work on so I need the data in excel sheet only.
Posted
Updated 5-Aug-20 20:41pm
Comments
Gerry Schmitz 31-Jul-20 12:18pm
   
So you think a million row Excel sheet is a "reasonable-thinking" solution?
Richard MacCutchan 1-Aug-20 3:56am
   
Split the .csv file into smaller pieces and import one by one.
Sandeep Mewara 1-Aug-20 5:19am
   
You looking for a programming way OR just some way to get a CSV data into an Excel sheet?
Puj07 4-Aug-20 16:24pm
   
No programming just some way to do this. I googled & found one solution which is below but do not know how to use it in excel. Please help.

FirstKeyValue = 0
LimitKeyValue = 1048576
NameCounter = 1

while FirstKeyValue <= MaxKeyValueInTable
DoCmd.OpenQuery "QueryWhichFetchesTheKeyRange", acViewNormal, acEdit
DoCmd.OutputTo acOutputQuery, , acFormatXLS, "FilePathAndName" & NameCounter & ".xls", True

LimitKeyValue = LimitKeyValue + 1048576
FirstKeyValue = FirstKeyValue + 1048576
NameCounter = NameCounter + 1
wend
Sandeep Mewara 4-Aug-20 17:20pm
   
If no programming, did you try this: https://help.supportability.com.au/article/250-how-to-open-csv-files-safely-with-microsoft-excel
Patrice T 6-Aug-20 1:19am
   
Use Improve question to update your question.
So that everyone can pay attention to this information.

1.Open a new Excel document and navigate to the Data tab
2.Click “From Text”
3.Navigate to the CSV file you wish to open and click “Import”
4.From the newly-opened window, choose “Delimited”. Then click “Next”
5.Check the box next to the type of delimiter – in most cases this is either a semicolon or a comma. Then click “Next”
6.Click “Finish”
That’s it; you have just imported a CSV file to Excel!
   
Quote:
How to import large .csv file into different excel sheets in a sequential manner

This smells like a bad solution to your real problem, probably because you know Excel and no other tool.
Quote:
Hi I have a large .csv file with more than 2 million rows

When I read 2 millions records, it smells like a table as I can't imagine something useful with Excel.

Can you explain what you want to do with this 2 millions records ?
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900