A powerful and efficient Node.js utility that automates the process of downloading images from URLs listed in an Excel spreadsheet. This tool organizes downloaded images into folders based on your specified categorization, making it perfect for bulk image management, e-commerce product asset organization, and data collection tasks.
- Bulk Image Downloading: Process hundreds of image URLs from a single Excel file.
- Smart Organization: Automatically creates folders based on row data and saves images within them.
- Intelligent File Naming: Renames images sequentially (e.g.,
image_1.jpg,image_2.png) to maintain order. - Format Detection: Automatically detects image file extensions from URLs or Content-Type headers.
- Error Handling: Skips invalid URLs without stopping the entire process and logs errors for review.
- Sanitized Folder Names: Ensures folder names are safe for the file system by removing invalid characters.
Before you begin, ensure you have the following installed on your machine:
-
Clone the repository or download the source code.
-
Navigate to the project directory in your terminal.
-
Install dependencies:
npm install
-
Prepare your Excel file:
- Create an Excel file named
input.xlsxin the root directory. - The first column should contain the names of the folders you want to create.
- The subsequent columns should contain the image URLs.
- Note: The first row is treated as a header and skipped if the first cell is "FolderName".
Example Structure:
FolderName Image1 URL Image2 URL ... Product_A http://example.com/img1.jpg http://example.com/img2.png ... Product_B http://example.com/img3.jpg ... - Create an Excel file named
-
Run the script:
npm start
-
Check the output:
- A
downloadsfolder will be created in the project root. - Inside, you will find subfolders corresponding to the names in your Excel file, containing the downloaded images.
- A
- Input File: The script looks for
input.xlsxby default. - Output Directory: Images are saved to the
downloadsdirectory.
To change these defaults, you can modify the INPUT_FILE and DOWNLOAD_DIR constants in index.js.
├── index.js # Main script file
├── package.json # Project dependencies and scripts
├── input.xlsx # (User provided) Input data file
└── downloads/ # (Generated) Output directory for images
This project is licensed under the ISC License.