New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

spreadit

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spreadit

Spreadsheet data importing simplified and 100% in the browser

latest
Source
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

Spreadit - Spreadsheet data importing simplified and 100% in the browser.

Spreadit is an angular directive inspired by the guys at Conference Badge. It imports data from Excel or CSV as JSON so it can be used in the browser or uploaded to the server. It supports header and column detection. Users can also rename and ignore columns before importing the data.

It's A Screenshot! It's Another Screenshot!

Install It

  • Manual: download latest from here
  • Bower: bower install spreadit --save
  • NPM: npm install spreadit

See It In Action

Code Sample

HTML:

<link href="spreadit.css" type="text/css" rel="stylesheet"/>

<script src="angular.min.js"></script>
<!-- needed to support csv -->
<script src="papaparse.min.js"></script>
<!-- needed to support Excel -->
<script src="xlsx.full.min.js"></script>
<script src="spreadit(.min).js"></script>

<button si-trigger="myId">Click Me To Import</button>
<si-column-manager
    si-id="myId"
    si-columns="columns"
    si-exclude-unknown-columns="false"
    si-sample-size="5"
    si-allow-renaming="true"
    si-post-processors="postProcessors"
    si-change="doStuffWithData($data, $file, $type)">
</si-column-manager>

Javascript:

var app = angular.module('superDopeDemo', ['bg.spreadit']);

app.controller('MyCtrl', ['$scope', function ($scope) {

    $scope.doStuffWithData = function(data, file, type) {

        console.log('file type: %s', type);
        console.log(data);
    };

    $scope.columns = [
        // matches becasue of title
        {
            title: 'Email',
            property: 'emailAddress'
        },
        // matches because of property
        {
            title: 'Last Name',
            property: 'last_name'
        },
        // matches because of alias
        {
            title: 'First Name',
            property: 'firstName',
            aliases: ['first_name', 'first']
        }
    ];

    $scope.postProcessors = [

        // concatenate first and last name to form a full name
        function (data) {
            if (data.firstName || data.last_name) {
                data.fullName = data.firstName + ' ' + data.last_name;
            }
            return data;
        },
        // capitalize full name
        function (data) {
            if (data.fullName) {
                data.fullName = data.fullName.toUpperCase();
            }
            return data;
        }
    ]
}]);

Keywords

spreadsheet

FAQs

Package last updated on 06 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts