Back to forum

loading local csv files

Answered

hi, can someone help me in solving this issue?
i have the following trivial html:
<html>
<head></head>
<body>
<div id=”wdr-component”></div>
<link href=”https://cdn.webdatarocks.com/latest/webdatarocks.min.css” rel=”stylesheet”/>
<script src=”https://cdn.webdatarocks.com/latest/webdatarocks.toolbar.min.js”></script>
<script src=”https://cdn.webdatarocks.com/latest/webdatarocks.js”></script>
<script>
var pivot = new WebDataRocks({
container: “#wdr-component”,
toolbar: true,
report: {
dataSource: {
filename: “c:\temp\data.csv”
}}});
</script>
</body>
</html>
when i open it an error message relating to a wrong filename syntax is issued. how should it be typed?
if i select the same file thru the ‘connect-to local csv’ command. the ‘loading data..’ window pops up indefinitely.
if i select the same file thru the same command in the https://www.webdatarocks.com/demos/javascript-pivot-table-demo/ demo page, everything’s fine.
thank you

2 answers

andres kosest February 3, 2020

sorry, where is the answer?

WebDataRocks Team WebDataRocks February 3, 2020

Hello, Andres,
 
Thank you for your question.
 
The problem you are facing appears because the browsers prevent loading local files directly from the file system. We recommend placing files on the local server in order to avoid making browsers connect to the local file system.
 
However, in case such a location of the file is required, we suggest refer to the following thread.
 
As for indefinitely loading when trying to connect to the local CSV file through, we would like to kindly recommend placing the following in the head element of your HTML page:

<meta charset="utf-8" />

 
That will specify an appropriate encoding and likely resolve the problem.
 
We hope it works for you.
 
Best regards,
WebDataRocks Team

Move up