Make a copy of a worksheet

How to use cDataSet.bigCommit() to create a copy of the values in a sheet

The .bigCommit() method of cDataSet will commit the contents of that dataset, normally back to the source sheet. However, bigcommit can also write to a different sheet. This behavior allows us make a copy of the values in a worksheet very simply.

VBA

Public Sub straightCopy()
    Dim ds As New cDataSet
    ds.populateData(wholeSheet("Sankey")).bigCommit _
            wholeSheet("messAround"), True

End Sub

Google Apps Script

function straightCopy() {
    new cDataSet().populateData(wholeSheet("Sankey")).bigCommit (
            wholeSheet("messAround"), true);
}


Take a look at One Liners for more tips like this. In the meantime why not join our forum,follow the blog or follow me on twitter to ensure you get updates when they are available.

You want to learn Google Apps Script?

Learning Apps Script, (and transitioning from VBA) are covered comprehensively in my my book, Going Gas - from VBA to Apps script, available All formats are available now from O'Reilly,Amazon and all good bookshops. You can also read a preview on O'Reilly

If you prefer Video style learning I also have two courses available. also published by O'Reilly.
Google Apps Script for Developers and Google Apps Script for Beginners.







Comments