Export TypeScript data to Excel in a stylish manner

I employ the xlsx package for writing data to an xlsx file.

This is my code:

const worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(myData);
const workbook: XLSX.WorkBook = { Sheets: { 'mySheet': worksheet }, SheetNames: ['mySheet'] };
XLSX.writeFile(workbook, 'MyData.xlsx');

I am interested in styling the cell contents. Is this possible and how can it be achieved?

I attempted using s without success:

worksheet['B1'].s = {font: {bold : true}};

UPDATE

"The documentation states that feature is only available in the pro version" - This comment holds true, I was not aware of this.

Hence my revised question:

Are there any alternative methods for exporting to an excel file with styles applied?

Answer №1

Instead of xlsx, consider utilizing the exceljs package within your Angular application.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

A guide on implementing nested child routes in AngularJS 2

I have successfully completed routing for two children, but now I want to display nested routes for those children. For example: home child1 child2 | grand child | grand child(1) ...

Issues with running NPM script for compiling TypeScript code

[UPDATE] Initially, I resolved this issue by uninstalling tsc using npm uninstall tsc (as recommended in the response marked as the answer). However, the problem resurfaced after some time, and eventually, I found success by utilizing Windows Server for L ...

Ways to manage an rxjs observable reaction that may potentially have no data?

Currently, I am working with Angular2 and Ionic2 using typescript and have a requirement to manage responses from the backend service. The response may either be empty with http status 200 or it could be a json object containing an error message property ...

Mocking callback or nested function with jest

My code snippet looks like this: public async waitForElementSelected(element: WebdriverIO.Element) { /** * Maximum number of milliseconds to wait for * @type {Int} */ const ms = 10000; await browser.waitUntil(async () =>{ ...

Configuring a NestJS application to establish a TypeOrm connection using environment variables and @nestjs/config

Looking for the best way to set up a NestJS database using a .env file in compliance with legal requirements. The goal is to utilize the @nestjs/config package to import .env variables and incorporate them into the TypeOrmModule. It appears that utilizing ...

Encountering issues with postinstall process on Elastic Beanstalk while incorporating webpack

I encountered a permission issue while attempting to deploy my fluxible node.js app to elastic beanstalk during the postinstall step. Is there a specific configuration that needs to be set on elastic beanstalk to resolve this? "postInstall": "node_module ...

Mastering the utilization of API routes within the Next JS 13 App Router framework

As a newcomer to React JS and Next.js, I recently made the switch from using the Page Router API in Next.js to utilizing the new App Router introduced in Next.js 13. Previously, with the Page Router, creating a single GET request involved nesting your "JS ...

Is Clarity Design compatible with Angular 15?

After updating my project to Angular version 15, I found that the clarity version I was using was as follows: "@cds/core": "5.0.0", "@clr/angular": "5.0.0", "@clr/icons": "5.0.0", "@clr/ui&qu ...

What could be causing TypeScript to struggle with verifying the return type of a function?

I am facing an issue with a function that is supposed to return NetworkState. However, despite the code clearly showing that the function does not return the correct type in most cases, TypeScript does not flag any errors. Can someone point out what I migh ...

Having difficulty determining the npm package that needs resolution

I am currently working on developing a tool in Alteryx with Python. I'm referring to the instructions provided in their tutorial, and encountering an issue related to npm. I have attempted to find a solution to this problem, but I am unsure which dep ...

Encountering problems with createMediaElementSource in TypeScript/React when using the Web Audio API

Currently, I am following a Web Audio API tutorial from MDN, but with a twist - I am using TypeScript and React instead of vanilla JavaScript. In my React project created with create-react-app, I am utilizing the useRef hook to reference the audio element ...

What steps can I take to troubleshoot npm install when it is unable to detect my python installation?

npm install is failing and I am determined to make it work. I currently have Python 2 installed, but its location is /usr/bin/python2 instead of /usr/local/bin/python2. Upon running npm install, I encounter the following error message: gyp verb cli &a ...

Utilize SystemJS to import chart.js within the index.html file

I am just starting to learn about angularjs (specifically angular js2). I am having some confusion with SystemJS importing and configurations. Currently, my angularjs2 application is working fine. I am developing it using Visual Studio. I have set up my ...

What should be the return type of a Jest test when written in a Typescript function?

When encapsulating a Jest test in a function with TypeScript, what is the expected return type? Thank you. const bar:ExpectedReturnType = () => test('this is another test', expect(false).toBeFalsy()); ...

Setting up Nest.js on a Centos 7 server

While attempting to install nest.js on CentOS 7, I encountered the following error message: file:///usr/lib/node_modules/@nestjs/cli/node_modules/@nuxtjs/opencollective/src/index.js:7 ;(async () => { ^ SyntaxError: Unexpected token ( npm W ...

The Node version on Macbook is not compatible

After updating to the latest stable version of node, I noticed a few versions listed when checking with nvm. Here is what I did to update: sudo npm cache clean -f sudo npm install -g n sudo n stable nvm use v8.1.0 When I checked with nvm list, it displa ...

Angular V8 build is not functioning correctly because it is broken

Unexpectedly, our ng build task in the VSTS pipeline is no longer functioning. Initially, the issue only appeared on VSTS, but when I cleared and reinstalled the node_modules on my local machine, I was able to replicate the problem. This leads me to believ ...

When attempting to install font-awesome with meteor npm, the module 'fontawesome'" was not found

Currently working with meteor version 1.4.1.1 which has NPM support enabled. I encountered an issue after installing the npm package "font-awesome" where the console displayed an error message stating "Uncaught Error: Cannot find module 'fontawesome&a ...

You are unable to elongate the interface 'http.IncomingMessage'. Were you intending to use 'implements' instead?

I have been struggling to execute the serve command for my angular project, encountering errors every time. Despite searching on Google for solutions, I have now reached a point where none of the answers seems to be helping. I recently downloaded a MEAN st ...

Adjust the scroll bar to move in the reverse direction

I'm trying to modify the behavior of an overlay div that moves when scrolling. Currently, it works as expected, but I want the scroll bar to move in the opposite direction. For example, when I scroll the content to the right, I want the scroll bar to ...