The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
How do you read in data from an excel in FAbric? I use crealytics in Synapse, but it doesn't work in Fabric. Has anyone tried?
Solved! Go to Solution.
Hi @hstance,
You can create a notebook to use pandas package function to read data from excel: (the sample file is upload to the files folder and I copy the api path to use in the functions)
import pandas as pd
# Read an Excel file from your Lakehouse into a Pandas DataFrame
# Replace LAKEHOUSE_PATH and FILENAME with your own values
df = pd.read_excel("/lakehouse/default/Files/test.xlsx")
display(df)
Read and write data with Pandas - Microsoft Fabric | Microsoft Learn
Regards,
Xiaoxin Sheng
Hi,
I found a way to use Crealytics project in MS Fabric:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>spark-excel-fatjar</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.crealytics</groupId>
<artifactId>spark-excel_2.12</artifactId>
<version>0.13.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<phase>package</phase>
<goals><goal>shade</goal></goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<!-- No relocations: keeps packages as-is -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Download the "Binary zip archive" from https://maven.apache.org/download.cgi
Extract the ZIP to a directory like C:\Program Files\Apache\Maven
Add Maven to the System Environment Variables:
Go to System Properties > Environment Variables
Under "System variables", edit Path and add:
Verify it works using mvn -v and run mvn clean package
Hi @hstance ,
Any update on this? Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.
If these also don't help, please share more detailed information and description to help us clarify your scenario to test.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
Hi @hstance,
You can create a notebook to use pandas package function to read data from excel: (the sample file is upload to the files folder and I copy the api path to use in the functions)
import pandas as pd
# Read an Excel file from your Lakehouse into a Pandas DataFrame
# Replace LAKEHOUSE_PATH and FILENAME with your own values
df = pd.read_excel("/lakehouse/default/Files/test.xlsx")
display(df)
Read and write data with Pandas - Microsoft Fabric | Microsoft Learn
Regards,
Xiaoxin Sheng
for some reason this doesn't work for me, I changed my lakehouse name, let's say it's called lakehouse_1. Then I use this
# Read in raw data
table_path = "/lakehouse_1/Files/test.xlsx"
pd_test = pd.read_excel(table_path)
and failed.
however, if I use the ABFS path as the table path, I can read the data successful. Can you please help me with the relative path?
User | Count |
---|---|
6 | |
2 | |
2 | |
2 | |
2 |
User | Count |
---|---|
20 | |
18 | |
6 | |
5 | |
4 |