Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to import excel file (XLSX) to mongoDB [closed]

I have a set of data as input to be given to MongoDB in XLSX format. How am I supposed to import the Excel file as input to MongoDB?

Is there any plugin available to import xlsx files as input to MongoDB?

like image 855
SUNDARRAJAN K Avatar asked Aug 11 '14 10:08

SUNDARRAJAN K


People also ask

How do I import XLSX file into database?

Import data directly from Excel files by using the SQL Server Import and Export Wizard. You also have the option to save the settings as a SQL Server Integration Services (SSIS) package that you can customize and reuse later. In SQL Server Management Studio, connect to an instance of the SQL Server Database Engine.

How do I open an XLSX file in MySQL?

Step 1: Click on the Browse button and select the Excel file you want to import to MySQL. Step 2: Select MySQL as your desired database. According to your excel file, check or uncheck My File has a Header Row. Step 3: Based on your Excel file, check Use CHECK IF TABLE EXISTS.


1 Answers

You cannot import an XLSX file into MongoDB directly. However, what you can do with an Excel spreadsheet is save it as a CSV file, then use mongoimport to import it into MongoDB. You can find the documentation for mongoimport here, but in any case, the command you need to run should look something like the following:

mongoimport --db myDb --collection myCollection --type csv --headerline --file /path/to/myfile.csv 

In the command above, the --headerline flag indicates that the first line in your file contains the name of the fields. There are many other options you can use depending on your needs. These are highlighted in the documentation.

like image 185
Juan Carlos Farah Avatar answered Oct 04 '22 07:10

Juan Carlos Farah