Skip to content

Web server that get Excel file and template JSON file to parse given Excel to JSON

Notifications You must be signed in to change notification settings

hramov/go-excel-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang Excel Parser service

Based on excelize

Description: web server that get Excel file and template JSON file to parse given Excel to JSON.

It generates JSON representation of data in Excel file based on fields in template.

Template example

{
  "id": 1,
  "title": "Test",
  "sheet_name": "Sheet1",
  "sheet_number": 1,
  "header_row": 1,
  "start_row": 2,
  "fields": [
    {
      "id": 1,
      "name": "id",
      "field": "userId",
      "type": "string"
    },
    {
      "id": 2,
      "name": "title",
      "field": "ProductTitle",
      "type": "string"
    }
  ]
}

There are two environment variable:

  1. PORT=3000 - server port;
  2. UPLOAD_PATH=data/upload/ - directory for storing incoming Excel files.

Request / Response example

From this Excel data

img_1.png

To this response

img.png

It matches fields by its name and thus there is no need to place columns in particular order.

Columns not described in template would be ignored.

About

Web server that get Excel file and template JSON file to parse given Excel to JSON

Topics

Resources

Stars

Watchers

Forks