Sheet2API
Sheet2API is a server API designed to read sheet files from various sources and provide them as read-only responses. It facilitates the swift creation of APIs to serve sheet files, empowering business teams to easily edit sheets on their own.
License
The source code is under GPL 3.0 and free for non-commercial use.
If you need it for commercial usage, feel free to contact me and it's only $1 per month.
Quickstart
-
Copy config.yaml.example
to config.yaml
-
Run script
go run main.go
The server will start default with binding IP 0.0.0.0 and port 14119 with following logs:
$ go run main.go
INF Config file 'config.yaml'
Start server: 0.0.0.0:14119
- Access URL http://localhost:14119/test/users and get the response
[
{
"Age": "32",
"Country": "United States",
"Date": "15/10/2017",
"First Name": "Dulce",
"Gender": "Female",
"Id": "1562",
"Last Name": "Abril"
},
{
"Age": "25",
"Country": "Great Britain",
"Date": "16/08/2016",
"First Name": "Mara",
"Gender": "Female",
"Id": "1582",
"Last Name": "Hashimoto"
},
{
"Age": "36",
"Country": "France",
"Date": "21/05/2015",
"First Name": "Philip",
"Gender": "Male",
"Id": "2587",
"Last Name": "Gent"
}
]
Configurations
Example:
host_ip: 0.0.0.0
host_port: 14119
files: [
{
file_path: "./test/users_test.xlsx",
api_replaced_name: "test",
cache_in_second: 0,
},
]
Configuration |
Description |
Default value |
host_ip |
The IP or hostname the app to bind to serve API |
0.0.0.0 |
host_port |
The port the app to bind to serve API |
14119 |
files.[x].file_path |
The file path of the sheet file that will be converted to API response. We support reading spreadsheet documents generated by Microsoft Excel™ 2007 and later |
{empty} |
files.[x].api_replaced_name |
The alias name to access from API with pattern: {host_ip}:{port}/{api_replaced_name}/{sheet_name} |
{empty} |
files.[x].cache_in_second |
The cache duration (in seconds) of file content. It avoid to access the file frequently. If value is less than or equal zero, the cache will be disabled |
0 |