title: Google sheets how to script: copy tab to new file?
body: <p>I'm new to using Google sheets, and got stuck trying to reproduce one of the simplest of Excel macro's in Google sheets.</p>
  <p>What i'm trying to do:</p>
  <p>In source file</p>
  <ul>
  <li>jump to source tab select this tab (containing calculations) &amp; copy (works)</li>
  <li>jump to temp tab paste only values &amp; format (works)</li>
  <li>copy out temp tab to new file (does not work)</li>
  </ul>
  <p>This would be my excel code for reference</p>
  <pre><code>Sub EXPORT()
  ' ---------------------------------------------------------------
  ' GRAB SOURCE TAB &amp; COPY
  ' ---------------------------------------------------------------
      Sheets(&quot;SOURCE&quot;).Select
      Cells.Select
      Selection.Copy
  ' ---------------------------------------------------------------
  ' SELECT TEMP TAB &amp; PASTE VALUES &amp; FORMAT (WITHOUT CALCULATIONS)
  ' ---------------------------------------------------------------
      Sheets(&quot;TEMP&quot;).Select
  '
      Range(&quot;A1&quot;).Select
      Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
          :=False, Transpose:=False
  '
      Range(&quot;A1&quot;).Select
      Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
          SkipBlanks:=False, Transpose:=False
  '
      Range(&quot;A1&quot;).Select
  ' ---------------------------------------------------------------
  ' COPY TEMP TAB OUT TO NEW FILE
  ' ---------------------------------------------------------------
      Range(&quot;A1&quot;).Select
      Sheets(&quot;TEMP&quot;).Select
      Application.CutCopyMode = False
      Sheets(&quot;TEMP&quot;).Copy
  
  End Sub
  </code></pre>
  <p>There are a few more things I'd like to do (such as determine new file name etc. based on a cel) etc. but after 2 days of searching I just don't understand why i'm stuck on something this simple.</p>
  <p>Manually it would simply be</p>
  <ul>
  <li>Right click tab</li>
  <li>copy to -&gt; new spreadsheet</li>
  </ul>
  <p>I've tried more or less everything from simply recording a Macro (which doesn't seem to record the new spreadsheet action) to implementing parts of code from questions that were far more complex than mine (and ended up doing something wrong getting errors), so I truly am sorry if this is a simple question but i'm so stuck :(</p>
  <p>thanks a lot for reading</p>
  <p>Tim</p>