Zend certified PHP/Magento developer

Google Spreadsheet published as CSV sometimes returns #VALUE

I’m publishing as a CSV a spreadsheet I’m maintaining in Google Sheets, to serve as a data source for other people/systems. It’s a simple 4-column data structure, resulting from a complicated calculation inside the spreadsheet.

Once about every 3 calls to this published URL, instead of good contents like this

Team,Baseline date,Baseline,Score
PZOA,2021-07-21,635,675
Advisory & Research,2021-07-27,880,880
Client Data,2021-06-11,430,520
...

I get this

#VALUE!       

It happens regardless of whether I use a browser, curl, wget or any other type of client. Also happens when the spreadsheet tab is published as a web page: every nth refresh produces a “#VALUE” error in the top cell even though no underlying data are changed. Another observation is that it happens more often if I request the data rapidly in sequence.

Any ideas how to prevent this from happening?