danfo.read_excel
Reads an excel file into DataFrame.
danfo.read_excel(source, configs) [source]
Parameters
Type
Description
source
string
source : string, URL or local file path to retreive Excel file.
configs
Object
{
sheet : string, (Optional) Name of the sheet which u want to parse. Default will be the first sheet. method: The HTTP method to use.
headers: Additional headers to send with the request if reading JSON from remote url. Supports all the node-fetch options in Nodejs, and all fetch options in browsers.
}
Returns:
** return **{Promise} DataFrame structure of parsed Excel data

Example

The read_excel method can read excel files saved on a local disk, or over the internet.
Node.js
Browser
1
const dfd = require("danfojs-node")
2
const path = require("path")
3
4
let local_xcel = path.join(process.cwd(), "data", "testexcel.xlxs")
5
6
async function load_process_data() {
7
let df = await dfd.read_excel(local_xcel)
8
df.head().print()
9
}
10
11
load_process_data()
Copied!
1
<!DOCTYPE html>
2
<html lang="en">
3
4
<head>
5
<meta charset="UTF-8">
6
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/bundle.min.js"></script>
8
<title>Document</title>
9
</head>
10
11
<body>
12
13
<script>
14
15
const remote_url = 'https://file-examples-com.github.io/uploads/2017/02/file_example_XLS_100.xls';
16
dfd.read_excel(remote_url).then(df => {
17
df.head().print()
18
})
19
20
21
</script>
22
</body>
23
24
</html>
Copied!
Last modified 17d ago
Copy link
Contents
Example