You've already forked csv_to_excel
118 lines
3.4 KiB
Markdown
118 lines
3.4 KiB
Markdown
# 📊 CSV to Excel GitHub Action
|
||
|
||
Transform a CSV file into an Excel (`.xlsx`) file.
|
||
This action is perfect for automating report generation, data transformation, or formatting pipelines in your CI/CD workflow.
|
||
|
||
---
|
||
|
||
## ✨ Features
|
||
|
||
- ✅ Converts any `.csv` file to an `.xlsx` Excel file
|
||
- 🏁 Customizable start cell for output placement
|
||
- 🔍 Adjustable logging for debugging and verbosity
|
||
- 🔐 Supports authenticated usage with AllSpice Hub
|
||
|
||
---
|
||
|
||
## 🚀 Usage
|
||
|
||
Add this action to your GitHub workflow:
|
||
|
||
```yaml
|
||
jobs:
|
||
convert:
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v3
|
||
|
||
- name: CSV to Excel
|
||
uses: https://hub.allspice.io/actions/csv-to-excel@v0.15
|
||
with:
|
||
source_path: "data/input.csv"
|
||
output_file_name: "output.xlsx"
|
||
start_cellname: "B2"
|
||
log_level: "DEBUG"
|
||
auth_token: ${{ secrets.ALLSPICE_AUTH_TOKEN }}
|
||
```
|
||
|
||
---
|
||
|
||
## 🔧 Inputs
|
||
|
||
| Name | Description | Required | Default |
|
||
|--------------------|-----------------------------------------------------------------------------------------------------|----------|------------------------|
|
||
| `source_path` | Path to the source `.csv` file from the root of the repo. | ✅ | – |
|
||
| `output_file_name` | Name of the output `.xlsx` file. | ✅ | `out_file.xlsx` |
|
||
| `start_cellname` | The Excel cell to start output (e.g., `A1`, `B2`). Useful for appending to preformatted templates. | ❌ | `A1` |
|
||
| `log_level` | Logging verbosity: `DEBUG`, `INFO`, `WARNING`, etc. | ❌ | `INFO` |
|
||
| `auth_token` | AllSpice Hub auth token. Defaults to `${{ github.token }}` if not provided. | ❌ | `${{ github.token }}` |
|
||
|
||
---
|
||
|
||
## 🐳 Under the Hood
|
||
|
||
This action is container-based and runs inside a Docker container specified by the included `Dockerfile`. It invokes a command with the appropriate flags and environment:
|
||
|
||
```bash
|
||
--start_cellname <CELL>
|
||
--output_file <PATH>
|
||
--log-level <LEVEL>
|
||
--source_path <CSV_PATH>
|
||
```
|
||
|
||
---
|
||
|
||
## 🔐 Authentication
|
||
|
||
If you're working in a private AllSpice Hub environment or require scoped access, supply an `auth_token` explicitly via `secrets`. Otherwise, GitHub’s default token will be used.
|
||
|
||
---
|
||
|
||
## 🧪 Example Workflows
|
||
|
||
### Minimal
|
||
|
||
```yaml
|
||
- name: Basic Conversion
|
||
uses: https://hub.allspice.io/actions/csv-to-excel@v0.15
|
||
with:
|
||
source_path: "logs/report.csv"
|
||
```
|
||
|
||
### With Custom Start Cell and Debug
|
||
|
||
```yaml
|
||
- name: Custom Conversion
|
||
uses: https://hub.allspice.io/actions/csv-to-excel@v0.15
|
||
with:
|
||
source_path: "reports/data.csv"
|
||
output_file_name: "custom.xlsx"
|
||
start_cellname: "D4"
|
||
log_level: "DEBUG"
|
||
```
|
||
|
||
---
|
||
|
||
## 📁 Output
|
||
|
||
After the action completes, your `.xlsx` file will be available in the workspace at the path:
|
||
```
|
||
${{ github.workspace }}/${{ inputs.output_file_name }}
|
||
```
|
||
|
||
You can use this in subsequent steps to upload artifacts, push to a repo, or attach to issues.
|
||
|
||
---
|
||
|
||
## 🛠️ Requirements
|
||
|
||
- GitHub Actions runner (`ubuntu-latest`)
|
||
- Docker support (used under the hood)
|
||
|
||
---
|
||
|
||
## 🧾 License
|
||
|
||
MIT © AllSpice.io
|