How can I export XLSL file?

Greetings!

I’m trying to export text layer contents as a “.xlsx” file from photoshop.
Since the base of UXP is JS, it is not that hard to make an xlsx object with SheetJS library.
the thing is… I can not write an available xlsx file that Excel can read.

this is the code that I’m trying to

let folder = await fs.getFolder();
if (!folder) return console.log("User canceled folder picker.");

const sessionToken = fs.createSessionToken(folder);
let excelFile = await folder.createFile("tmp.xlsx", {overwrite: true});
const saveFile = await fs.createSessionToken(excelFile);
let wb = XLSX.utils.book_new();
let ws = XLSX.utils.aoa_to_sheet(layerTextList, {sheet: "TextBox"});
XLSX.utils.book_append_sheet(wb, ws, "TextBox");
const content = await XLSX.write(wb, {type: "array", bookType: "xlsx", bookSST: false});
await excelFile.write(content, {append: false, format: formats.binary});

this code generates only garbage file that cannot read :frowning:
Is there any way that I can write xlsx file?
(file should be xlsx cause text contains ‘,’ and Korean letters)

Many thanks in advance.

As far as I can tell, writing w/ biff5 to an .xls file works fine, but something looks mucked up in how the zip file is constructed (it’s way too short) for xlsx files. No errors are raised, so I’m not sure where anything is failing – I’d have expected a thrown error if UXP were missing something that this depended on. I also know that JsZip does work w/ UXP, but maybe there’s something off in the version this plugin uses?

Can you use xls for now?

1 Like

Hey!
How about exporting to .CSV file, will that do? I use that in one of my plugin.

1 Like

.xls with biff5 worked! Thank you so much!