Attaching the generated xlsx file to a record in Salesforce as a file attachment #3039
Labels
No Label
DBF
Dates
Defined Names
Features
Formula
HTML
Images
Infrastructure
Integration
International
ODS
Operations
Performance
PivotTables
Pro
Protection
Read Bug
SSF
SYLK
Style
Write Bug
good first issue
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#3039
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I have created an xlsx file using sheetjs with Salesforce LWC (https://docs.sheetjs.com/docs/demos/cloud/salesforce/). The problem is that the file is downloaded directly. I want it to be saved in Salesforce as well on a record. Is there any way to achieve this?
Attaching image for reference.
The
XLSX.writeFile
call creates the file and initiates the download:Instead, you can use
XLSX.write
. You must pass an options argument that specifiesbookType: "xlsx"
(file format) and a desiredtype
(output type). For example, the following line generates a base64 string representing the workbook:If you need the data in a Uint8Array:
XLSX.write
returns the file data without initiating a download.There is likely some sort of API that lets you upload the generated file data. If not, you should be able to make a POST request to some endpoint in the Salesforce API (see https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/intro_input.htm#cc_upload_binary_files for an example).