danfo.read_excel

Reads an excel file into DataFrame.

danfo.read_excel(kwargs) [source]

Parameters

Type

Description

kwargs

Object

{

source: string, URL or local file path to retreive Excel file.

sheet_name: string, (Optional) Name of the sheet which u want to parse. Default will be the first sheet.

header_index: int, (Optional) Index of the row which represents the header(columns) of the data. Default will be the first non empty row.

data_index: int, (Optional)Index of the row from which actual data(content) starts. Default will be the next row of header_index

}

Returns:

return DataFrame

Example

The read_excel method can read excel files saved from local disk, or over the internet.

Node.js
Browser
Node.js
const dfd = require("danfojs-node")
local_xcel = 'testexcel.xls'
async function load_process_data() {
let df = await dfd.read_excel({source: local_xcel})
df.head().print()
}
load_process_data()
Browser
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--danfojs CDN -->
<script src="https://cdn.jsdelivr.net/npm/danfojs@0.0.15/dist/index.min.js"></script>
<title>Document</title>
</head>
<body>
<div id="plot_div"></div>
<script>
const remote_url = 'https://file-examples-com.github.io/uploads/2017/02/file_example_XLS_100.xls';
dfd.read_excel({ source: remote_url }).then(df => {
df.head().plot("plot_div").table()
})
</script>
</body>
</html>