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

Issue with read.xlsx on enumeration of sheets #542

Open
Tee-Party opened this issue Jun 9, 2022 · 0 comments
Open

Issue with read.xlsx on enumeration of sheets #542

Tee-Party opened this issue Jun 9, 2022 · 0 comments

Comments

@Tee-Party
Copy link

Expected Behavior

I intended to load the first sheet from an excel file which had three sheets, using the read.xlsx command.

Data2 <- read.xlsx("FileName2.xlsx", sheet = 1, colNames = TRUE, cols = DesiredCols2)

Actual Behavior

This produced the following Error Message:

No data found on worksheet.

I found out that I could access the desired sheet either by using the name of the sheet for the argument "sheet", or by setting the argument "sheet" to the index +1.
sheet = 2 returned the first sheet, sheet = 3, second sheet and so on.

In the same R file I used the same command before to load a sheet from another xlsx file which had only one sheet. Here the indexing worked as expected.

Steps to Reproduce the Problem

Data <- read.xlsx("FileName.xlsx", sheet = 1, colNames = TRUE, cols = DesiredCols)
Indexing worked as expected
Data2 <- read.xlsx("FileName2.xlsx", sheet = 1, colNames = TRUE, cols = DesiredCols2)
Indexing didnt behave as expected

Unfortunately I cant provide an example file.

sessionInfo()

  • Version of openxlsx: 4.2.3
  • Version of R: 4.0.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant