Skip to content

Commit

Permalink
chore: adjust readme
Browse files Browse the repository at this point in the history
chore: wip
  • Loading branch information
chrisbbreuer committed Dec 20, 2024
1 parent ddb5577 commit a7b4981
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 12 deletions.
71 changes: 63 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,33 @@
<!-- [![npm downloads][npm-downloads-src]][npm-downloads-href] -->
<!-- [![Codecov][codecov-src]][codecov-href] -->

# Bun Spreadsheets
# Spreadsheets

Easily generate spreadsheets, like CSVs and Excel files.

## ☘️ Features

- Generate CSV files
- Generate Excel files
- Generate CSV & Excel files
- Store spreadsheets to disk
- Download spreadsheets as a Response object
- Simple API for creating and manipulating spreadsheets
- Library & CLI support
- Fully typed
- Optimized for Bun
- Lightweight & dependency-free

## 🤖 Usage

There are two ways to interact with `ts-spreadsheets`: via the CLI or as a library.

### Library

As a library, you will want to make sure to install it in your project:

```bash
bun install ts-spreadsheets
```

Now, you can use it in your project:
_Now, you can use the library in your project:_

```ts
import { createSpreadsheet, spreadsheet } from 'ts-spreadsheets'
Expand Down Expand Up @@ -73,8 +78,6 @@ console.log('CSV Content:', rawCsvContent)
console.log('Excel Content:', rawExcelContent)
```

## 📚 API Documentation

### Main Functions

#### spreadsheet(data: Content)
Expand Down Expand Up @@ -187,7 +190,59 @@ await spreadsheet(data).store('output.xlsx')
await spreadsheet(data).generateExcel().store('output.xlsx')
```

To view the full documentation, please visit [https://stacksjs.org/docs/ts-spreadsheets](https://stacksjs.org/docs/ts-spreadsheets).
To view the full documentation, please visit [https://ts-spreadsheets.netlify.app](https://ts-spreadsheets.netlify.app).

### CLI

You can also use the CLI to generate spreadsheets from JSON input:

```bash
# Create a spreadsheet from JSON input
spreadsheets create data.json -o output.csv
spreadsheets create data.json --type excel -o output.xlsx

# Convert between formats
spreadsheets convert input.csv output.xlsx
spreadsheets convert input.xlsx output.csv

# Validate JSON input format
spreadsheets validate input.json
```

The input json should follow this format:

```json
{
"headings": ["Name", "Age", "City"],
"data": [
["John Doe", 30, "Los Angeles"],
["Jana Schmidt", 25, "Berlin"],
["Bob Johnson", 35, "London"]
]
}
```

#### CLI Commands

- `create`: Generate a spreadsheet from JSON input
- Options:
- `-t, --type <type>`: Output type ('csv' or 'excel'), defaults to 'csv'
- `-o, --output <path>`: Output file path
- `convert`: Convert between spreadsheet formats
- Automatically detects format from file extensions
- Supports conversion between CSV and Excel formats
- `validate`: Check if JSON input meets the required format
- Validates structure and data types
- Provides helpful error messages for invalid input

All commands support the `--help` flag for more information:

```bash
spreadsheets --help
spreadsheets create --help
spreadsheets convert --help
spreadsheets validate --help
```

## 🧪 Testing

Expand Down
7 changes: 3 additions & 4 deletions docs/intro.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<p align="center"><img src="https://github.com/stacksjs/ts-spreadsheets/blob/main/.github/art/cover.jpg" alt="Social Card of this typescript spreadsheets repo"></p>

# Bun Spreadsheets
# Spreadsheets

Easily generate spreadsheets, like CSVs and Excel files.

## ☘️ Features

- Generate CSV files
- Generate Excel files
- Generate CSV & Excel files
- Store spreadsheets to disk
- Download spreadsheets as a Response object
- Simple API for creating and manipulating spreadsheets
- Library & CLI Support
- Fully typed
- Optimized for Bun
- Lightweight & dependency-free

## 📈 Changelog
Expand Down

0 comments on commit a7b4981

Please sign in to comment.