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] <title>Spark Excel reads all Excel files under the file #753

Closed
1 task done
xuhaosanqiu opened this issue Jul 10, 2023 · 3 comments
Closed
1 task done

[BUG] <title>Spark Excel reads all Excel files under the file #753

xuhaosanqiu opened this issue Jul 10, 2023 · 3 comments

Comments

@xuhaosanqiu
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I used the following method to read all the files in the folder, but the efficiency was slow

val files = new File(directoryPath).listFiles.filter(_.getName.endsWith(".xls"))
var df = spark.emptyDataFrame
for ((file, index) <- files.zipWithIndex) {
val temdf = spark.read.excel(
header = true,
dataAddress = "0!A1"
).load(file.toString)
if (index == 0) {
df = temdf
}else{
df = df.union(temdf)
}
}

Expected Behavior

Is it possible to directly read all the files under the folder? Union is too time-consuming

Steps To Reproduce

No response

Environment

- Spark version:
- Spark-Excel version:
- OS:
- Cluster environment

Anything else?

No response

@nightscape
Copy link
Owner

@xuhaosanqiu
Copy link
Author

Hello, I read the windos local folder and told me that there is insufficient permission for the java. io. FileNotFoundException. But it can be read from a single file. Is there a solution?

 <dependency>
        <groupId>com.crealytics</groupId>
        <artifactId>spark-excel_2.12</artifactId>
        <version>3.0.1_0.18.7</version>
    </dependency>

@nightscape
Copy link
Owner

Not sure if I can help with this, but you'd need to at least provide the full information from this page:
https://github.com/crealytics/spark-excel/blob/main/.github/ISSUE_TEMPLATE/generic.yml

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

2 participants