sheetjs

JS Library to create formatted XLSX spreadsheets

青春壹個敷衍的年華 提交于 2021-01-29 13:39:05
问题 I'm currently creating generic spreadsheets in JS using https://www.npmjs.com/package/xlsx . This works fine to generate just a generic spreadsheet to display my data. However, I wanna add a few features. https://imgur.com/a/gJE9mXg is an example of what I want to achieve. It was created using Apache POI, which is only available for Java. The features I want in that screenshot are The ability to add a picture (seen as a logo in the top-left) Ability to change font-color (as seen in the Title

Read a file with XLSX.readFile

别等时光非礼了梦想. 提交于 2021-01-29 11:48:46
问题 In Typescript, I've got the error "Cannot read property 'replace' of undefined" executing: const xlsx = XLSX.readFile(fileName); filename is a path to an existing file; I've read that "readFile is only available in server environments. Browsers have no API for reading arbitrary files given a path, so another strategy must be used." How can I do? Edit: the file I'm trying to read is an xlsx; it's zipped: does the library have a bug? I'm running xlsx@0.15.1 回答1: NodeJS API allows you to work

SheetJS: Do Not Include Headers In json_to_sheet

有些话、适合烂在心里 提交于 2021-01-05 07:36:10
问题 The SheetJS documentation shows a way to take a JSON Object and convert it to an Excel sheet. From their example: var ws = XLSX.utils.json_to_sheet([ {S:1,h:2,e:3,e_1:4,t:5,J:6,S_1:7}, {S:2,h:3,e:4,e_1:5,t:6,J:7,S_1:8} ], {header:["S","h","e","e_1","t","J","S_1"]}); By default, the header information is Object.keys. The output looks like this in excel: My question: how do I leave out the header when converting from Json_to_sheet? I do not want the header in my output, only the numbers in the

Javascript Read Excel file on server with SheetJS

做~自己de王妃 提交于 2020-12-01 12:09:38
问题 I am using a library called SheetJS and I want to read an excel sheet that resides on the server without using nodejs, only pure javascript. Is this possible? There is a message in the documentation that says "readFile is only available in server environments. Browsers have no API for reading arbitrary files given a path, so another strategy must be used" With the above message, I assume the author is referring to a situation where the file is residing on the client side. This is what I have

How to write into a particular cell using xlsx npm package

不打扰是莪最后的温柔 提交于 2020-06-26 08:14:22
问题 I have to write a value to a particular cell (say the D4 cell) in my xlsm file. I can see the option of XLSX.writeFile(workbook, 'out.xlsx'); in https://www.npmjs.com/package/xlsx#writing-functions to write , but I am not seeing anything to write a value to a particular cell(where should the values which needs to be written passed ?). Or, it is not as clear as the example provided to read a particular cell value. Would be glad if someone could provide me a simple example of snippet. This is

SheetJS xlsx-cell styling

亡梦爱人 提交于 2019-12-23 19:29:56
问题 I am referring this example to export a worksheet https://github.com/SheetJS/js-xlsx/issues/817. How to do cell styling like background coloring,font size and increasing the width of the cells to make the data fit exactly.I have gone through the documentation but couldn't find any proper examples to use fill etc.Is there a way to do the formatting? Below is the code snippet: /* make the worksheet */ var ws = XLSX.utils.json_to_sheet(data); /* add to workbook */ var wb = XLSX.utils.book_new();

How to export Excel file from Angular Material 5 Mat-Table (Angular Material Table)?

给你一囗甜甜゛ 提交于 2019-12-13 04:23:02
问题 I am new to Angular and using Angular material 5 mat-table and trying to export the table in a excel file. I have use SheetJS XLSX package. Below is my code: Table.component.html: <mat-table #table [dataSource]="dataSource" matSort> <!-- ID Column --> <!--<ng-container matColumnDef="ID"> <mat-header-cell *matHeaderCellDef mat-sort-header> UserID </mat-header-cell> <mat-cell *matCellDef="let row"> {{row.UserID}} </mat-cell> </ng-container>--> <!-- Progress Column --> <ng-container matColumnDef

Convert .xlsx file with merged cells to JSON with SheetJS

老子叫甜甜 提交于 2019-12-13 04:21:46
问题 I'm trying to read a .xlsx file with SheetJS and convert it into JSON. I'm able to read and convert a simple (without merged cells) .xlsx file to JSON, but I'm not getting it right with merged cells. The problem is that I have a .xlsx file with products in different languages. I tried searching for a solution on different websites and the github repository of SheetJS https://github.com/sheetjs/js-xlsx/#json with mediocre success. Mostly addressing how to write merged cells. function

Filereader read file using correct encoding when read as readAsArrayBuffer

谁都会走 提交于 2019-11-30 05:52:54
问题 I am working on reading .csv /xlsx file uploaded using javaScript and get the result as array containing each row . I was able to read the file and get data using FileReader and SheetJs with following code. // code for the new excel reader $scope.do_file = function(files) { $scope.fileContent = []; var X = XLSX; var global_wb; var f = files[0]; var reader = new FileReader(); reader.onload = function(e) { var data = e.target.result;console.log(data); global_wb = X.read(data, {type: 'array'});

Filereader read file using correct encoding when read as readAsArrayBuffer

a 夏天 提交于 2019-11-28 10:38:58
I am working on reading .csv /xlsx file uploaded using javaScript and get the result as array containing each row . I was able to read the file and get data using FileReader and SheetJs with following code. // code for the new excel reader $scope.do_file = function(files) { $scope.fileContent = []; var X = XLSX; var global_wb; var f = files[0]; var reader = new FileReader(); reader.onload = function(e) { var data = e.target.result;console.log(data); global_wb = X.read(data, {type: 'array'}); var output = ""; var result = {}; global_wb.SheetNames.forEach(function(sheetName) { var roa = X.utils