Skip to content

Instantly share code, notes, and snippets.

@jeff-r-koyaltech
Created September 18, 2023 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeff-r-koyaltech/ca06f246726040220150f19554f2d10d to your computer and use it in GitHub Desktop.
Save jeff-r-koyaltech/ca06f246726040220150f19554f2d10d to your computer and use it in GitHub Desktop.
Long worksheet names - excel4node
import * as excel4node from 'excel4node';
// https://stackoverflow.com/questions/48643025/sheetjs-repaired-records-worksheet-properties-from-xl-workbook-xml-part-work
const main = () => {
const myWb = new excel4node.Workbook();
const longNameWs = myWb.addWorksheet(
'This is more than thirty-one characters'
);
longNameWs.cell(1, 1).string('Just a value');
myWb.write('temp.xlsx');
};
main();
@notrexhere
Copy link

Hi there,
Do you happen to know if it is possible to delete a worksheet or replace its content using this package?
Thanks!

@jeff-r-koyaltech
Copy link
Author

Hi @notrexhere , I haven't tried that / needed it in my projects yet. Based on the lack of a rmWorksheet method here:
https://github.com/natergj/excel4node/blob/4d560c6be37e89a3fe7486db0105d1ba17596a34/source/lib/workbook/workbook.js#L230

I'm guessing no. I don't see anything else that can delete from this.sheets

@notrexhere
Copy link

Hi Jeff,

Thank you for the reply. Too bad there is no delete method, usually it is the first thing to do after an "add" :-)

It is OK though - no problem.

Thanks again for the info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment