Hi all,
I am going through a very critical situation where I cannot find bright ideas to work upon.
I have an google spread sheet which contains few rows and columns.
I want to combine the row together including its column value.(1 row with four columns which results to a single sentence)
Simultaneously each row should form a single sentence from the google spread sheet.
My spread sheet path: https://docs.google.com/spreadsheets/d/1Z7_oRxlTIiKIND89sAXHbyTsz1mrTMNwejqkfk8y5P0/edit#gid=0
I dont know how to strt of with this and which function, code to prefer ?
Any kind of help is appreaciated.
Hello all,
Below is the code which I have tried so far and returns the output which I wanted.
<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br>";
echo "No files...!!!!!";
echo "<script>alert('No files...!!!!!');window.location.href='upload_file.php';</script>";
}
else
{
$a=$_FILES["file"]["tmp_name"];
$csv_file = $a;
if (($getfile = fopen($csv_file, "r")) !== FALSE) {
$data = fgetcsv($getfile, 1000, ",");
while (($data = fgetcsv($getfile, 1000, ",")) !== FALSE) {
//$num = count($data);
//echo $num;
//for ($c=0; $c < $num; $c++) {
$result = $data;
$str = implode(",", $result);
$slice = explode(",", $str);
$col1 = $slice[0];
$col2 = $slice[1];
$col3 = $slice[2];
echo $col1."".$col2."".$col3."<br/>";
}
}
}
?>
But now the case is that the files are been uploaded from .csv file.
I want the fetch data from directly “google spread sheet” URL.
In the baove code what will be the logic to add the spread sheet URl ?
any help is appreciated.
Thankyou…!!
lorenw
July 26, 2014, 3:12pm
3