npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

secure-spreadsheet

v0.2.1

Published

Secure your data exports - encrypt and password protect sensitive CSV and XLSX files

Downloads

10,273

Readme

Secure Spreadsheet

:fire: Secure your data exports - encrypt and password protect sensitive CSV and XLSX files

The Office Open XML format provides a standard for encryption and password protection

Works with Excel, Numbers, and LibreOffice Calc

Build Status

Getting Started

Install the CLI

npm install -g secure-spreadsheet

Convert a CSV into password-protected, AES-256 encrypted XLSX

secure-spreadsheet --password secret < input.csv > output.xlsx

Protect an existing XLSX

secure-spreadsheet --password secret --input-format xlsx < input.xlsx > output.xlsx

Languages

You can use the CLI to create encrypted spreadsheets in other languages.

Pull requests are welcome for more languages.

PHP

<?php

$csv_str = "awesome,csv";

$descriptorspec = array(
  0 => array("pipe", "r"),
  1 => array("pipe", "w")
);

$process = proc_open(["secure-spreadsheet", "--password", "secret"], $descriptorspec, $pipes);

if (!is_resource($process)) {
  die("Command failed");
}

fwrite($pipes[0], $csv_str);
fclose($pipes[0]);

$result = stream_get_contents($pipes[1]);
fclose($pipes[1]);

if (proc_close($process) != 0) {
  die("Command failed");
}

file_put_contents("output.xlsx", $result);

Python

import subprocess

csv_str = b'awesome,csv'

result = subprocess.check_output(['secure-spreadsheet', '--password', 'secret'], input=csv_str)

with open('output.xlsx', 'wb') as f:
    f.write(result)

Ruby

require "open3"

csv_str = "awesome,csv"

result, status = Open3.capture2("secure-spreadsheet", "--password", "secret", stdin_data: csv_str)
raise "Command failed" unless status.success?

File.write("output.xlsx", result)

Other Approaches

An alternative approach to secure your data is to create a password-protected ZIP archive. However, this leaves the data exposed after it’s unzipped.

Notes

The content type for XLSX is application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.

Credits

Thanks to xlsx-populate for providing the encryption and password protection.

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

To get started with development:

git clone https://github.com/ankane/secure-spreadsheet.git
cd secure-spreadsheet
npm install