score:4
Try this code:
<?php
$filename = 'info.csv';
$contents = file($filename);
foreach($contents as $line) {
$data = explode(",",$line);
$val = "[Date.UTC(".substr($data[0],0,4).",".(substr($data[0],4,2)).",".substr($data[0],6,2).",".$data[1].",".$data[2].",".$data[3]."),".$data[4]."],";
}
?>
score:11
See the fgetcsv
and fputcsv
PHP functions. It will basically be something like:
if (($handle1 = fopen("input.csv", "r")) !== FALSE) {
if (($handle2 = fopen("output.csv", "w")) !== FALSE) {
while (($data = fgetcsv($handle1, 1000, ",")) !== FALSE) {
// Alter your data
$data[0] = '...';
// Write back to CSV format
fputcsv($handle2, $data);
}
fclose($handle2);
}
fclose($handle1);
}
Source: stackoverflow.com
Related Query
- Modify a csv file line by line
- Highcharts to display area range and line chart with data from a CSV file
- Return the next line of a csv file each time a php script is called
- Creating a line graph with highcharts and data in an external csv
- Exporting highcharts data to CSV file
- JavaScript code inside TypeScript file .ts not working
- How I can customize the file name when exporting using the plug-in CSV in Highcharts?
- Not able to draw a Pie Chart with external csv file in HighCharts
- How to load more than on CSV file in highcharts?
- Add Source to Highcharts Export CSV
- Highcharts dynamicly update chart from csv file
- How to join geojson + CSV file with omnivore leaflet in Mapbox to map data as polygons?
- Reading uploaded csv file in highcharts
- Preprocess Highchart data using CSV file
- Highcharts not displaying data but drawing chart when reading from CSV file
- Strange character in the Highstock source code
- Highcharts series visibility with csv data source
- uploading external csv file to highcharts not working
- Load JSON file into highcharts to draw a Line Chart
- Modify length of Highcharts sankey-diagram connection line
- How to change line color when loading static csv data into Highcharts Highstock graph?
- Scrape Highcharts data to CSV file
- How to generate proper csv file format using javascript
- PHP and highcharts: add mysql results as new column in CSV file
- Highcharts CSV File
- How to export a .xls file from a website as a CSV file?
- Highcharts Highstock How to Plot OHLC and Line Charts from One Set of Embedded CSV Data Using Series Map Tools?
- How to show an additional column from CSV file as a tooltip in Highcharts
- Highcharts: How to show only one data »category« from CSV as a line
- Plot Y axis data based on x axis values from a csv file : Highcharts
More Query from same tag
- Passing data from $ajax call to highcharts
- Plot always starts at 0, highstock spline chart
- Highcharts appends two types of charts in one div
- Dynamic Highstock chart when no data at start
- Horizontal bar chart with outline behind bar
- Best way to add different colours based on conditions to bargraphs plotted with Highcharts.js
- Highcharts with custom scaling in upper regions
- change data on chart by selecting the year in dropdowns
- High Chart set x axis value in hours format
- highstock with json data
- JSF+HighCharts Integration Issue
- Inserting series data in highcharts dynamically
- Trim or hide Highchart legends based on number of legends
- highcharts - render text with decimal 'x' and 'y'
- Highcharts pie chart loses color on refresh
- How add custom content HighCharts PDF export?
- Display blank space if data is not present for a particular date
- HIGHCHARTS auto-rotate x-axis labels for custom positioned labels
- HighCharts: Increase width and padding of stacked bar graph
- IE 9 64 bit Rendering Issue
- Passing list of dictionary to a .js file to create highcharts using python flask
- Highcharts minPointLength on columnrange not working
- How to display consistent datetime label formats in xAxis using highchart?
- Multi Series Timeline (Highcharts)
- Display List of array objects in highcharts
- Dragging line charts horizontally to show past/future data in Highcharts
- How do I show multiple datapoints in HighMaps?
- how to control orders of charts in highcharts combination charts?
- Highcharts export chart along with outer div
- HighCharts - How to combine JS and SQL for two charts?