Author Topic: Importing Excel from <input type="file"> error  (Read 4853 times)

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 210
    • View Profile
Importing Excel from <input type="file"> error
« on: November 03, 2025, 06:16:05 pm »
My code is simple:

Code: [Select]
$("#fileInput").change(function(e){
var file = e.target.files[0],
filename = file ? file.name.toLowerCase() : "";

if(file && (filename.endsWith("csv") || filename.endsWith("xlsx")))
{
pq.excel.importXl({ file:file }, function(wb) {
if(wb)
{
// Import the workbook
$("#grid")
.pqGrid("importWb", { workbook: wb, sheets:[0] });
}
});
}
});

I get the attached error from the line "pq.excel.importXl({ file:file }, function(wb) {"

Any ideas???


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6552
    • View Profile
Re: Importing Excel from <input type="file"> error
« Reply #1 on: November 03, 2025, 06:36:17 pm »
The sheets parameter belongs to the importXl method, not importWb.

Please check if this resolves the error.
« Last Edit: November 03, 2025, 06:42:26 pm by paramvir »

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 210
    • View Profile
Re: Importing Excel from <input type="file"> error
« Reply #2 on: November 03, 2025, 08:58:05 pm »
I changed import Wb to importXl, but it made no difference because it doesn't get that far, it breaks before that on
Code: [Select]
pq.excel.importXl({ file:file }, function(wb) {
Unless I have misunderstood, please could you post the changes you mean.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6552
    • View Profile
Re: Importing Excel from <input type="file"> error
« Reply #3 on: November 03, 2025, 09:30:46 pm »
I meant:

Code: [Select]
pq.excel.importXl({ file:file, sheets: [0] }, function(wb) {

can you please share your spreadsheet as an attachment, you can email it to support if it's too big.

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 210
    • View Profile
Re: Importing Excel from <input type="file"> error
« Reply #4 on: November 03, 2025, 09:39:07 pm »
I had already done that and it was left in the code above by accident.

Seet attached and I am still on v10.1.0

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6552
    • View Profile
Re: Importing Excel from <input type="file"> error
« Reply #5 on: November 04, 2025, 09:07:51 pm »
Confirmed an issue with v10.1.0, please upgrade to v11.0.0 as the issue is fixed in the latest version.

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 210
    • View Profile
Re: Importing Excel from <input type="file"> error
« Reply #6 on: November 07, 2025, 07:38:09 pm »
Please can you post a patch or a few lines of code fix for v10.1 as we haven't upgraded and tested v11 yet.