Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/knjcode/autometa
Generate various data from Excel spreadsheet
https://github.com/knjcode/autometa
Last synced: 29 days ago
JSON representation
Generate various data from Excel spreadsheet
- Host: GitHub
- URL: https://github.com/knjcode/autometa
- Owner: knjcode
- License: apache-2.0
- Created: 2014-07-27T10:37:39.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-10-20T15:40:23.000Z (about 8 years ago)
- Last Synced: 2024-10-06T07:09:47.492Z (2 months ago)
- Language: CoffeeScript
- Homepage:
- Size: 110 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - knjcode/autometa - Generate various data from Excel spreadsheet (CoffeeScript)
README
# autometa [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]
Generate various data from Excel spreadsheet.
## Overview
![overview](images/overview.png)
1. Extract "A1" cell value as "Template ID" from each Excel worksheet
2. Extract all cells value according to [Template ID].csv
3. Embed these values into [Template ID].ejs
4. Save as FileName specified in an Excel worksheet## Installation
via [npm (node package manager)](http://github.com/isaacs/npm)
$ npm install -g autometa
## Examples
### Basic example
Generate data from note-example.xlsx as mentioned in the overview above.
$ autometa note-example.xlsx
### Horizontal repetitive elements example
Generate data from Excel spreadsheet includes an element repeated horizontally.
$ autometa test-repeat.xlsx
test-repeat.xlsx
![test-repeat.xlsx](images/test-repeat.png)
catalog.csv
FileName,B2
Title,B3
Artist,B4
Country,B5
Company,B6
Price,B7
Year,B8catalog.ejs
<% for (i=0; i
<%- Title[i] %>
<%- Artist[i] %>
<%- Country[i] %>
<%- Company[i] %>
<%- Price[i] %>
<%- Year[i] %>
<% } -%>
### Vertical repetitive elements example
Generate data from Excel spreadsheet includes an element repeated vertically.
test-repeat2.xlsx
![test-repeat2.xlsx](images/test-repeat2.png)
catalog-v.csv
FileName,A2
Title,A4
Artist,B4
Country,C4
Company,D4
Price,E4
Year,F4catalog-v.ejs (same as catalog.ejs)
<% for (i=0; i
<%- Title[i] %>
<%- Artist[i] %>
<%- Country[i] %>
<%- Company[i] %>
<%- Price[i] %>
<%- Year[i] %>
<% } -%>
### Horizontal and vertical repetitive elements
Of course, you can generate data from Excel spreadsheet includes elements repeated horizontally and vertically.
## Multiple worksheets
You can get data from each worksheet of Excel spreadsheets.
## Templates directory
Autometa search templates ([Template ID].csv and [Template ID].ejs) in the current directory of input file first.
If templates not found, search default templates directory ([autometa package directory]/templates).
If you want to add templates directory, set AUTOMETA_TEMPLATES environment variable.$ export AUTOMETA_TEMPLATES="/path/to/your/templates"
## Original Templates
If you want to define original templates, create [Template ID].csv, [Template ID].ejs and place these files in the templates directory.
You can use ect templates ([Template ID].ect) instead of ejs templates. If both ejs and ect templates exist, autometa will use ejs.You can also place templates by register option (-r or --register-templates).
$ autometa -r [Template ID].ejs [Template ID].csv
$ Register success: [Template ID].ejs placed on [templates directory]
$ Register success: [Template ID].csv placed on [templates directory]## Set a filename manually
If you want to set a filename of first sheet manually, use `-o, --output` option.
$ autometa -o /path/to/your/filename note-example.xlsx
If specified filename is "/dev/stdout" or "-", autometa place output on stdout.
$ autometa -o /dev/stdout note-example.xlsx
When you use this option, Excel worksheet's FileName is ignored.
## Set a Template ID manually
If you want to set a Template ID manually, use `-t, --set-template-id` option.
$ autometa -t your-template-id note-example.xlsx
When you set this option, Excel worksheet's Template ID is ignored.
## Usage manual
$ autometa -h
Usage: autometa [options]Options:
-h, --help output usage information
-v, --version output the version number
-f, --force overwrite existing files
-p, --print-templates-dirs print templates directories
-o, --output set output file name of first
sheet manually
-r, --register-templates register template files
-t, --set-template-id set a Template ID manuallyEnvironment variable:
AUTOMETA_TEMPLATES Set ":"-separated list of directories,
if you want to change templates directory.## Dependencies
commander, ect, ejs, xlsjs, xlsx, readline-sync
## References
Example data in reference to [XML Examples]
## License
Copyright © 2014-2016 [Kenji Doi (knjcode)](https://github.com/knjcode)
Licensed under the [Apache License, Version 2.0][Apache][npm-url]: https://npmjs.org/package/autometa
[npm-image]: https://badge.fury.io/js/autometa.svg
[travis-url]: https://travis-ci.org/knjcode/autometa
[travis-image]: https://travis-ci.org/knjcode/autometa.svg?branch=master
[Apache]: http://www.apache.org/licenses/LICENSE-2.0
[XML Examples]: http://www.w3schools.com/xml/xml_examples.asp