I have a spreadsheet file with columns labeled as image
and name
. My goal is to extract the image, convert it to ByteArray, and save the data as a JSON object structured like this:
{ image: ByteArrya, name: string }
.
Here is the JavaScript form code I am working with:
<label className="flex items-center gap-3 px-3 py-2 bg-[#1D6F42] text-white text-blue rounded-md cursor-pointer">
<RiFileExcel2Line size={22} />
<span className="text-base leading-normal">Upload From Excel</span>
<input type="file" className="hidden" disabled={formLoading} onChange={(e) => handleFormSubmit("file", e)} accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"/>
</label>
I am looking for a JavaScript function that can take an xlsx file input and then convert it into JSON data.