Forcing Google Sheets to Publish Now

Google Sheets allows you to publish data on the Internet as a .XLS or .CSV file, etc. I have a system in which I edit the spreadsheet, and when I finish, I run a script that downloads the .csv file and processes it for use on our website.

The problem is that the created .csv file sometimes becomes outdated for several minutes, which means that every time I finish editing, I need to click the "publish on the Internet" → "reissue now" button before running my script. This becomes a routine for me and is not acceptable to ask my other users to remember.

I need to either get my command line script to automatically notify Google of the republishing, or find another way to get the current data from my spreadsheet.

+5
source share
2 answers

I have found a solution; Using the credentials to log in to Google and download the sheet gives you a fully live version and can be easily automated. Details on the blog: http://blogs.ecs.soton.ac.uk/webteam/2012/02/08/getting-live-google-spreadsheets/

+4
source

Google Sheets now has a setting for automatic republishing when changes are made, but when I use it, it seems that one more thing happens: the old version is cached by something on the Google side.

Adding a new parameter to the end of the URL (e.g. &foo=12312 ) &foo=12312 avoid the cache and return the current version. If you are working from a script, simply use the current time or a randomly generated number as the parameter value.

0
source

Source: https://habr.com/ru/post/1390858/


All Articles