OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Google Sheets Image() function now requires users to hit Allow Access

  • Thread starter Thread starter Raul
  • Start date Start date
R

Raul

Guest
Accessing data from external parties is newly blocked by default for any spreadsheets. This change happened starting on 07/02/2024. I have many PHP scripts that creates spreadsheets and prints them in PDF programmatically but now the spreadsheets cannot access data from external parties anymore and thus the result is wrong.

I cannot find a way in the Google Sheets API documentation how to allow access programmatically.

Before day 7 all the flow was working correctly, the image URLs are public and without access restrictions, anyone has a solution to grant access programmatically?

here is some of the code where I use the IMAGE() function:

Code:
foreach($ORDEN["pics_docs"] as $pic)
{
    $currentRow++;
    array_push($requests_mergeCellsInRow, get_mergeCellsInRow_request($currentRow, $sc, $ct, $sheetId));
    array_push($requests_formatForCells, get_formatConceptWForRow($currentRow, $sc, $ct, $sheetId));
    array_push($requests_updateDimensionPropertiesForRow, get_updateDimensionPropertiesForRow_request($currentRow, $imgw, $sheetId));
    array_push($values_forCells_userEntered,["=IMAGE(\"".$urlImages."/".$id_orden."/".$pic["doc_name"]."\"; 1)", "", "", "", "", "", "", "", "", ""]);
    $currentRow++;
    array_push($values_forCells_userEntered, []);
}
insertValuesOnCellsRange($values_forCells_userEntered, $sheetName.'!A3', $serviceSheets, $spreadsheetID, "USER_ENTERED");
batchUpdate(array_merge($requests_mergeCellsInRow, $requests_bordersForCells, $requests_formatForCells, $requests_updateDimensionPropertiesForRow), $serviceSheets, $spreadsheetID);

The sheet is correct except for the lock permission which breaks the flow and the only permissions I have assigned to the sheet is:

Code:
    $newPermission = new Google_Service_Drive_Permission();
    $newPermission->setType("anyone");
    $newPermission->setRole("reader");
    $result = $serviceDrive->permissions->create($spreadsheetID, $newPermission, array('fields' => 'id'));

I attach a couple of images with the legend of the problem

Message Warning in a new spreadsheet with image() in A1 cell

Message in spreadsheets generated by script

Continue reading...
 

Latest posts

M
Replies
0
Views
1
Muhammad Rafli Aditya. H
M
Top