Take the 2-minute tour ×

I am trying to use dygraph for javascript.

<script type="text/javascript"
<div id="graphdiv2"
<script type="text/javascript">
  g2 = new Dygraph(
    "C:/temperatures.csv", // path to CSV file   ***This file is local file in my C: drive***
    {}          // options

temperatures.csv is a local file on my machine. I read couple of posts that state .csv file has to be on a remote machine. I wonder is there a way to read local .csv file. Can you suggest some solution to this please. Thanks.

share|improve this question
add comment

2 Answers

In general, you cannot load local files via JavaScript. This would be a huge security hole.

If you want to enable this for local development, you can run Chrome with the --allow-file-access-from-files command-line flag. I assume other browsers have similar options. You may also need to add a "file://" before the "c:\" in your path.

share|improve this answer
add comment

This works fine for me on Firefox with the CSV file in the same directory as the HTML file. Then just open the HTML file locally as a file://whatever and pass "input.csv" to dygraphs.

No turning off of security options needed - but I don't know about Chrome.

share|improve this answer
add comment

Your Answer


