I am trying to convert Google Sheet to XLSX and download it via HTTP (all done by script, exported again on every request).
First, I tried the code solution provided here and it did indeed work and sent the file by email.
Then, I tried to do the request and download the file on my own via code/curl. As I know URL and Authorization Bearer token it should have been easy.
var url = "https://docs.google.com/spreadsheets/d/" + file.getId() + "/export?format=xlsx";
var token = ScriptApp.getOAuthToken();
The cUrl example for this looked like this:
curl --location --request GET 'https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/export?format=xlsx' --header 'Authorization: Bearer TOKEN_ID'
It did work properly for some time but recently it stopped working, even though it does work within Google Script returning proper response code (200) and the result. Currently it returns Error code 400: Bad Request instead if done from curl/external code.
Did I miss some update from Google that made such requests not possible from outside of Google Script itself?