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

fast-js-excel

v2.0.1

Published

Fast excel file maker

Downloads

14

Readme

Fast JS Excel

v2.0.1 This is a package i made for myself but can surely be helpful to others, feel free to contribute if you like it.

[!WARNING] This lib is the most-inclusive between my 3 utils libraries. If you don't need excel js but other file utils install word-file-utils or take a look at utils-stuff wich is the lighter package. DO NOT INSTALL ALL THREE LIBS CAUSE ONE IS THE "PARENT" OF THE OTHER:

  1. utils-stuff
  2. word-file-utils (including utils-stuff)
  3. fast-js-excel (including exceljs, word-file-utils (including utils-stuff))

So if you install word-file utils you can use the classes of utils-stuff and so on, choose the one for your pourpose.

Install:

npm install fast-js-excel

With this package comes the alessiovelluso/utils-stuff, a package of server/client utilities that can be helpful, be sure to check the library for all the different utilities you can use. This one has basically two different classes GenericUtils & ClientFilters, you can import them just as explained from the lib documentation but using "fast-excel". The same with the alessiovelluso/word-file-utils wich is included too, giving the chance to use translations and csv/json/object basic parsing but with ease.

import { GenericUtils } from "word-file-utils"

At the moment, the package exports:

type WriteWorkbook<T extends GenericObject = GenericObject> = (output:string, worksheets:WfuWorksheet<T>[]) => Promise<void>;

export type CreateWorkbook<T extends GenericObject = GenericObject> = (worksheets:WfuWorksheet<T>[]) => Workbook

A brief explanation of the methods:

1. Create Workbook
createWorkbook: <T extends GenericObject = GenericObject>(worksheets:WfuWorksheet<T>[]) => Promise<Workbook>;

Returns an ExcelJs.Workbook ready to be passed with an api

const  wfu = new  Wfu({ separator:  "|" });

const  data = [{col1:"Test1",col2:"Test2"},{col1:"Test3",col2:"Test4"}]
wfu.createWorkbook<{ Key:string, Value:string }>([
	{
		name:  "Worksheet1", data,
		prepend: {
			title:  "Details", rows:1,
			data: { Test:  "A Text", Test2:  543543, "Test_Date":  new  Date() }
		}
	}
]);

Look at test repos for other examples

2. Write Workbook
writeWorkbook:<T extends GenericObject = GenericObject>(output:string, worksheets:WfuWorksheet<T>[]) => Promise<void>;

Write a workbook locally using the related method createWorkbook

WRITE THE OUTPOUT WITHOUT THE FINAL EXTENSION LIKE:

writeWorkbook("../Files/test", [...])

Types

import { Column } from  "exceljs"
import { GoogleTranslateLocales } from  "./translate.types"


export  interface  TranslationConfig { translatingCol:string, cultureFrom:GoogleTranslateLocales, cultureTo:GoogleTranslateLocales }

export  interface  TranslateCsvConfig  extends  TranslationConfig { csvFilepath:string, outFilepath:string, separator?:string }

export  interface  TranslationMakerConstructor { separator?:string, errorTranslationValue?:string, translationColumnName?:string }

export  interface  WfuExcelColumn  extends  Partial<Column> { name:string, parse?: 'date' };

export  type  WfuWorksheetDetails = { title:string, rows?:number, data: GenericObject, patternColor?: string }

export  interface  WfuWorksheet<T  extends  GenericObject = GenericObject> {
	name: string,
	data:T[],
	prepend?: WfuWorksheetDetails
	append?: WfuWorksheetDetails,
}