You need to sign in to do that
Don't have an account?
Gulnawaz Aamir 7
Converting excel to JSON using lightning component
I want to convert the excel sheet into json format, I succeed in converting using Vf page but I want to convert this using Lightning component. Does anyone have any idea for this
cmp File
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" >
<!--<ltng:require scripts="{!join(',',$Resource.First,$Resource.Second,$Resource.Third)}" afterScriptsLoaded="{!c.handleUploadFinished}"/>
<ltng:require scripts="{!$Resource.First}" afterScriptsLoaded="{!c.handleUploadFinished}"/>
<ltng:require scripts="{!$Resource.Forth}" afterScriptsLoaded="{!c.handleUploadFinished}"/>-->
<ltng:require scripts="{!$Resource.Third}" afterScriptsLoaded="{!c.handleUploadFinished}"/>
<ltng:require scripts="{!$Resource.Second}" afterScriptsLoaded="{!c.handleUploadFinished}"/>
<lightning:input type="file" label="Attachment" aura:id="file" multiple="false" onchange="{! c.handleUploadFinished }" name="btn"/>
</aura:component>
JS Controller
({
handleUploadFinished: function (component, event,helper) {
// Get the list of uploaded files
var name = event.getSource().get("v.name");
if(name=='btn'){
var uploadedFiles = event.getSource().get("v.files")[0];
alert("Files uploaded : " + uploadedFiles.size);
var wb = readSarf(uploadedFiles);
alert(wb);
}
}
})
Now you need to Upload Three JS files into your static resource, I am pasting the files as text, copy these text as save as JS file like First.js,Second.js and Third.js
First
**************************************************************************
Sorry the files are very big I can not paste here, Send me email Id I will send you on that
Regards,
Gulnawaz Aamir