Hie,

I know there are many great logic idea mind out here.
I have a code for fetching CSV file data which uploads data and then fetch csv file and then fetch the content from the file and displays in the frontend.
Basically, the CSV file created is from the google doc spreadsheet.
Its a long process to first download the google spreadsheet in .csv extension and then to upload on my script and fetch the data.
But is there any better way to simply fetch data directly from google doc.
I tried but did not find a proper solution.

PHP Code:

<?php
//if ($_FILES["https://docs.google.com/spreadsheets/d/1g-SMSAhkqot4BiQwDSw7pALnJAaEycg75eiBK6dz3Hc/edit#gid=0"]["error"] > 0)

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
{
   echo 
"Upload: " $_FILES["file"]["name"] . "<br>";
   echo 
"Type: " $_FILES["file"]["type"] . "<br>";
   echo 
"Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br>";
   
//echo "Stored in: " . $_FILES["file"]["tmp_name"];
$a=$_FILES["file"]["tmp_name"];
$csv_file $a

if ((
$getfile fopen($csv_file"r")) !== FALSE) {
        
$data fgetcsv($getfile1000",");
  while ((
$data fgetcsv($getfile1000",")) !== 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];
}
}
}
?>
Could someone here please help me out.
Please let me know if any concerns.