Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ruzhila/excel_csv_to_json_or_markdown
A Go program that converts data from Excel or CSV files to JSON or Markdown format.
https://github.com/ruzhila/excel_csv_to_json_or_markdown
100-line-code campus-project csv-to-json csv-to-markdown golang
Last synced: about 2 months ago
JSON representation
A Go program that converts data from Excel or CSV files to JSON or Markdown format.
- Host: GitHub
- URL: https://github.com/ruzhila/excel_csv_to_json_or_markdown
- Owner: ruzhila
- License: bsd-3-clause
- Created: 2024-04-27T09:00:21.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-04-30T10:32:48.000Z (8 months ago)
- Last Synced: 2024-06-19T03:36:47.434Z (7 months ago)
- Topics: 100-line-code, campus-project, csv-to-json, csv-to-markdown, golang
- Language: Go
- Homepage: https://ruzhila.cn/blog?from=github_excel_go
- Size: 16.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Excel/CSV to JSON/Markdown Converter
This repository contains a Go program that converts data from Excel or CSV files to JSON or Markdown format.
By [ruzhila.cn](http://ruzhila.cn/?from=github_mget), a campus for learning backend development through practice.
### 🚀 [100-line-code](https://github.com/ruzhila/100-line-code) A collection of learning projects written in 100 lines of code
This is a tutorial code demonstrating how to use Golang for data transformation. Pull requests are welcome. 👏
## Description
The program takes two command-line arguments: the input file and the output file. It reads the data from the input file and writes it to the output file in the specified format. The format is determined by the file extension.
- If the output file has a `.json` extension, the program writes the data as an array of JSON objects. The keys of the objects are taken from the first row of the input file, and each subsequent row is written as a separate object.
- If the output file has a `.md` extension, the program writes the data as a Markdown table.
## Usage
```bash
go run main.go input.xlsx output.json
go run main.go input.csv output.md
```## Dependencies
This program uses the following Go libraries:
- `encoding/csv` for reading CSV files
- `encoding/json` for writing JSON files
- `os` for file operations
- `path/filepath` for handling file paths
- `github.com/qax-os/excelize` for reading Excel files