Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Spreadsheet turn off autosave via script?
    primarykey
    data
    text
    <p>I'm fairly new to using Google Docs, but I have come to really appreciate it. The scripting is pretty easy to accomplish simple tasks, but I have come to realize a potential speed issue that is a little frustrating.</p> <p>I've got a sheet that I use for my business to calculate the cost of certain materials on a jobsite. It works great, but was a little tedious to clear between jobs so I wrote a simple script to clear the ranges (defined by me and referenced by name) that I needed emptied.</p> <p>Once again, worked great. The only problem with it is that clearing a few ranges (seven) ends up taking about ten full seconds. I -believe- that this is because the spreadsheet is being saved after each range is cleared, which becomes time intensive.</p> <p>What I'd like to do is test this theory by disabling autosave in the script, and then re enabling it after the ranges have been cleared. I don't know if this is even possible because I haven't seen a function in the API to do it, but if it is I'd love to know about it.</p> <hr> <p>Edit: this is the function I'm using as it stands. I've tried rewriting it a couple of times to be more concise and less API call intensive, but so far I haven't had any luck in reducing the time it takes to process the calls.</p> <pre><code>function clearSheet() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getActiveSheet(); sheet.getRange("client").clear(); sheet.getRange("lm_group_1").clear({contentsOnly:true}); sheet.getRange("lm_group_2").clear({contentsOnly:true}); sheet.getRange("dr_group_1").clear({contentsOnly:true}); sheet.getRange("dr_group_2").clear({contentsOnly:true}); sheet.getRange("fr_group_1").clear({contentsOnly:true}); sheet.getRange("fr_group_2").clear({contentsOnly:true}); sheet.getRange("gr_group_1").clear({contentsOnly:true}); sheet.getRange("client_name").activate(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload