Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Import Excel doesn't retain column names?! #3073

Open
3 tasks done
patc3 opened this issue Dec 10, 2024 · 9 comments
Open
3 tasks done

[Bug]: Import Excel doesn't retain column names?! #3073

patc3 opened this issue Dec 10, 2024 · 9 comments
Assignees
Labels
Bug: Medium Bugs that don't influence the basic function of the app, but it's better to fix them at some point. Component: Import/Export

Comments

@patc3
Copy link

patc3 commented Dec 10, 2024

JASP Version

0.19.2

Commit ID

No response

JASP Module

Unrelated

What analysis are you seeing the problem on?

No response

What OS are you seeing the problem on?

Windows 10

Bug Description

The new import Excel in 0.19.2 seems to work except that it replaces all variable names with V1 through Vk (where k is number of columns)? Also I see from August that this uses freexl, never heard of it and I'm not sure why it's not using one of the several established Excel libraries in R? I use readxl to read Excel files in R

Excel file:

image

Imported into JASP:

image

Expected Behaviour

Retain column names when importing Excel file

Steps to Reproduce

  1. import Excel file
  2. witness through eye sight that the column names have been replaced with V1-Vk

Log (if any)

No response

More Debug Information

No response

Final Checklist

  • I have included a screenshot showcasing the issue, if possible.
  • I have included a JASP file (zipped) or data file that causes the crash/bug, if applicable.
  • I have accurately described the bug, and steps to reproduce it.
@shun2wang
Copy link
Contributor

shun2wang commented Dec 11, 2024

Hummm, this is again a FreeXL quirk, I'll see what we can do. FreeXL does not recognize the column name with underscores. A temporary solution is to copy and paste the column name from Excel/libreOffice.

I use readxl to read Excel files in R

I introduced it because it is stable and lightweight enough and we didn't use R libraries as data importing tools but only lightweight dependencies to reading files. @boutinb @JorisGoosen let’s discuss the solution:

  1. FreeXL is slow to update, so we have to consider patching it.
  2. Considering maintainability, should we switch to another library?

@JorisGoosen
Copy link
Contributor

Well 'readxl' uses libxls apparently, maybe its better.

But freexl seems to work mostly, we could just fork, fix it it and use that fixed version while we wait for them to update?
Or is it already fixed and they are extremely slow?

@shun2wang
Copy link
Contributor

shun2wang commented Dec 11, 2024

  1. libxls is not supported on conan on Windows and it just importing .xls not .xlsx, so we need more library to read .xlsx.
  2. I maintained fork to fix it but Bruno or you want we just using it from conan? see feat: implement importing excel (.xls .xlsx) files jasp-desktop#5638

@tomtomme tomtomme added Bug: Medium Bugs that don't influence the basic function of the app, but it's better to fix them at some point. Component: Import/Export and removed Bug OS: Windows 10 labels Dec 11, 2024
@shun2wang
Copy link
Contributor

shun2wang commented Dec 21, 2024

There are something different, @patc3 could you share a sample file with it? because I cannot reproduce it again.

I guess only with some column names in .xlsx created by MS-Excel?

@patc3
Copy link
Author

patc3 commented Dec 21, 2024

Something odd: this comes from a data.frame I exported from R using writexlsx (I think--maybe some other R package), and when I load it directly in JASP the variable names import as V1 V2 etc., but if I open the Excel file and save it (without changing anything), then JASP opens it correctly. So maybe some minor, invisible detail about how R exports to Excel, that Excel fixes when you open it with Excel and save. I don't know.

But my point is: My original data (exported from R) has that problem when I import it in JASP, but as soon as I modify the file using Excel the problem is fixed. So I can't reproduce the problem either (probably could reproduce simply by exporting as Excel file from R and importing into JASP without going into Excel and saving the file)

@JorisGoosen
Copy link
Contributor

@patc3 well, maybe just export to csv from R?
Why export to excel in the first place?

@patc3
Copy link
Author

patc3 commented Dec 22, 2024

@JorisGoosen I don't need help importing data into JASP, I was merely testing the new Excel import functionality

@JorisGoosen
Copy link
Contributor

Sure, thanks!

It's more that it also sounds like a bit of a bug in that R-package?
But I guess that if Excel can read it fine we should also be able.

@shun2wang
Copy link
Contributor

hummmm, it's indeed a bug for column names with a _ inside .xlsx file which created by MS-Excel. OK I can reproduce it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Medium Bugs that don't influence the basic function of the app, but it's better to fix them at some point. Component: Import/Export
Projects
None yet
Development

No branches or pull requests

5 participants