cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

XLSX external library working fine in BAS but not working in Fiori Launchpad

tejaswikosanam
Explorer
0 Kudos
3,875

Hi, 

I am using xlsx.full.min.js file in a File upload project. The xlsx.full.min.js is included in a folder under webapp and referencing it correctly.

tejaswikosanam_0-1718304985561.png

When I run the file locally in SAP BAS it's working fine. But when I deployed and ran from Fiori Launchpad it's throwing error as XLSX.read is not a function.

tejaswikosanam_0-1718304501064.png

I tried  /* global XLSX:true */ at the top of the controller. But the issue still occurs.

 

Could you please suggest how do I resolve this issue.

Accepted Solutions (1)

Accepted Solutions (1)

sani2608
Explorer
0 Kudos

For me this works, I am not referring to the file in the controller, I can access XLSX globally.

"js": [  {    "uri": "libs/xlsx.js"   }   ],

I'm using this CDN -  https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.0/xlsx.js
I was using the CDN first, but later I copied the code locally.

tejaswikosanam
Explorer
0 Kudos

I tried this but it didn't work for me. Below solution worked for me:
https://community.sap.com/t5/technology-q-a/howto-use-3rd-party-lib-with-content-security-policy-omi...

Answers (2)

Answers (2)

rahullohia
Product and Topic Expert
Product and Topic Expert

When you run this application in FLP, can you check the network tab in developer tools and search for this file? Also, have you specified this in the manifest.json under resources?

"js": [
{
"uri": "libs/xlsx.full.min.js"
}
]

 

tejaswikosanam
Explorer
Hi Rahul, I have tried this option but it didn't resolve the issue. I even tried using sap.ui.loader.config. Even this one couldn't resolve the issue. I am not able to see that file in Network tab at all. Do I need to follow different procedure for external libraries in BAS and Launchpad?
sani2608
Explorer
0 Kudos

.

sani2608
Explorer
0 Kudos
For me this works without any issue, I'm not even referring the path in the on top.
tejaswikosanam
Explorer
0 Kudos
Hi Sani, you installed them using npm or how are handling this?
sani2608
Explorer
0 Kudos
I have done in same way what you are sharing in screenshot, the only difference is that I did not import it in sap.ui.define(), it just worked.
Noel_Hendrikx
Active Contributor
0 Kudos

I'd suggest not to use a relative path, but the full namespace instead. The file path is rendered differently, check out the network tab for the 404 not found lib file how it is being rendered.

 

tejaswikosanam
Explorer
0 Kudos
Hi Noel, I have changed to full namespace but still it's not working. I checked Network tab but there the file is not visible at all. Not sure whether it's loading at all. I tried using sap.ui.loader.config. But still it's not working. Is there any other procedure I have to follow? In QA system it's working well. Do I need update anything like tooling modules or install xlsx through BAS commands?