<?php
require_once 'PHPExcel/PHPExcel.php';
$downloadedFileName = "sheet.xls";
set_time_limit(0);
if (file_exists($downloadedFileName)) {
unlink($downloadedFileName);
}
$spreadsheet_url="Google Sheet with 4 tabs URL goes here";
file_put_contents($downloadedFileName,file_get_contents($spreadsheet_url));
if (file_exists($downloadedFileName)) {
$inputFileType = PHPExcel_IOFactory::identify($downloadedFileName);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcelReader = $objReader->load($downloadedFileName);
$loadedSheetNames = $objPHPExcelReader->getSheetNames();
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcelReader, 'CSV');
foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
$objWriter->setSheetIndex($sheetIndex);
$objWriter->save($loadedSheetName.'.csv');
}
}
else{
echo "File not found";
}
?>
This gives an error :
Fatal error: Uncaught exception 'PHPExcel_Calculation_Exception' with
message 'ArticulosQueNoSonKARE!A1 -> internal error' in
D:\xampp\htdocs\xlstocsv\PHPExcel\PHPExcel\Cell.php:291 Stack trace: #0
D:\xampp\htdocs\xlstocsv\PHPExcel\PHPExcel\Worksheet.php(2492): PHPExcel_Cell-
>getCalculatedValue() #1
D:\xampp\htdocs\xlstocsv\PHPExcel\PHPExcel\Writer\CSV.php(142):
PHPExcel_Worksheet->rangeToArray('A1:M1', '', true) #2
D:\xampp\htdocs\xlstocsv\index.php(30): PHPExcel_Writer_CSV-
>save('ArticulosQueNoS...') #3 {main} thrown in
D:\xampp\htdocs\xlstocsv\PHPExcel\PHPExcel\Cell.php on line 291
I can figureout that its because of some cells containing formulas..But I need to take that value from the cell. I have no edit permission to modify and edit those cells. I need this script running as a chrone job.. Ihave done with the other part. Please help. Thank you