# Command line script to bulk load .xlsx data into ES

**URL:** <https://discuss.elastic.co/t/command-line-script-to-bulk-load-xlsx-data-into-es/6695>\
**Category:** Elasticsearch\
**Created:** [February 13, 2012, 9:43pm UTC](https://discuss.elastic.co/t/command-line-script-to-bulk-load-xlsx-data-into-es/6695 "2012-02-13T21:43:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stratawing](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@stratawing](https://discuss.elastic.co/u/stratawing)\
**Post date:** [February 13, 2012, 9:43pm UTC](https://discuss.elastic.co/t/command-line-script-to-bulk-load-xlsx-data-into-es/6695/1 "2012-02-13T21:43:27Z")

</div>

I have a use case where users are permitted to upload xlsx files with  
up to 10,000 records per xlsx file. The xlsx file has 9 fields, 4 of  
which are numbers (double), and 5 of which are variable length  
strings.

Accordingly, I was messing around with importing .xlsx files into ES  
using the bulk operation and, after tossing out various xml parsers  
due to speed issues, came up with the following:

> <https://gist.github.com/stratawing/1820634>

Using this relatively simple command line script, I was able to parse  
and bulk load 10,000 records into ES in under 2 seconds -- with about  
1 second of the total time coming from parsing the xlsx file.

Caution: This isn't really general purpose (i.e. - no excel date  
conversion, only text and numbers, depends on (m)awk), but hopefully  
it can help someone along the way.

Note that there are a bunch of xlsx parsers out there that are  
probably much "safer" (see, e.g. Apache POI) but I had some spare time  
to kill today.....

Cheers!

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 14, 2012, 2:33pm UTC](https://discuss.elastic.co/t/command-line-script-to-bulk-load-xlsx-data-into-es/6695/2 "2012-02-14T14:33:00Z")

</div>

Thanks for sharing!

On Monday, February 13, 2012 at 11:43 PM, stratawing wrote:

> I have a use case where users are permitted to upload xlsx files with  
> up to 10,000 records per xlsx file. The xlsx file has 9 fields, 4 of  
> which are numbers (double), and 5 of which are variable length  
> strings.
> 
> Accordingly, I was messing around with importing .xlsx files into ES  
> using the bulk operation and, after tossing out various xml parsers  
> due to speed issues, came up with the following:
> 
> [Command Line Script to bulk load XLSX into ES · GitHub](https://gist.github.com/1820634)
> 
> Using this relatively simple command line script, I was able to parse  
> and bulk load 10,000 records into ES in under 2 seconds -- with about  
> 1 second of the total time coming from parsing the xlsx file.
> 
> Caution: This isn't really general purpose (i.e. - no excel date  
> conversion, only text and numbers, depends on (m)awk), but hopefully  
> it can help someone along the way.
> 
> Note that there are a bunch of xlsx parsers out there that are  
> probably much "safer" (see, e.g. Apache POI) but I had some spare time  
> to kill today.....
> 
> Cheers!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:39am UTC](https://discuss.elastic.co/t/command-line-script-to-bulk-load-xlsx-data-into-es/6695/3 "2017-07-06T03:39:22Z")

</div>


