Download multiple but not all sheets in Google Spreadsheets

I’m working with a Google Spreadsheet that contains three sheets:

  • Sheet A has all my combined data
  • Sheets B and C contain report formats with filtered data.

I need to download only Sheets B and C together, but I can only find a way to download individual sheets using their GID. Is there an efficient way to download both Sheets B and C at once without including Sheet A?

New contributor

Olivia Maria is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

0

Download specific sheets from a spreadsheet

You can achieve “downloading” a new spreadsheet with a unique name containing the two specific sheets that you want by following these steps:

This will involve creating a google apps script that is connected to your original spreadsheet(which contains the three sheets)
This script will create a new spreadsheet then will copy sheet B and Sheet C to that new spreadsheet and this new spreadsheet will then be saved to your Google Drive, which you can download.

Set-up script

Open your spreadsheet that contains the three sheets then at the navigation menu at the top, click “extensions” then click apps script

Google apps script editor will open on a new browser window, this is where you will paste the code below(clear the contents of the script before pasting my code)

On the apps script editor, click the run button located at the menus at the top

After that, an execution log will appear at the bottom of the screen where you will find the link of the newly created spreadsheet, copy that link and paste it on a new browser window to access the new spreadsheet

You will now access the new spreadsheet that contains the two sheets

You can also check the new spreadsheet named (“Exported Sheets”+ current date)

Sample Code

function exportSheets() {
  // Open the current spreadsheet(where the three sheets are present)
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  //for pasting the link of the new spreadsheet
  var sheetA = ss.getSheetByName("Sheet A");

  // Create a new spreadsheet where sheet B and C will be stored together
  var date = new Date();
  var newSpreadsheet = SpreadsheetApp.create('Exported Sheets '+date);

  // Get the two sheets, sheet B and C
  var sheetB = ss.getSheetByName('Sheet B'); //replace with the appropriate name of the 'sheet B' from the spreadsheet
  var sheetC = ss.getSheetByName('Sheet C');  //replace with the appropriate name of the 'sheet C' from the spreadsheet

  // Copy sheets B and C to the new spreadsheet
  if (sheetB) {
    sheetB.copyTo(newSpreadsheet).setName('Sheet B');
  }
  if (sheetC) {
    sheetC.copyTo(newSpreadsheet).setName('Sheet C');
  }

  // Check if there is a default empty sheet on the newly created sheet and remove it if present
  var sheets = newSpreadsheet.getSheets();
  if (sheets.length > 1) {
    var defaultSheet = sheets[0];
    if (defaultSheet.getName() === 'Sheet1') {
      newSpreadsheet.deleteSheet(defaultSheet);
    }
  }
  
  // Log the URL of the new spreadsheet
  Logger.log('New Spreadsheet URL: ' + newSpreadsheet.getUrl());

  //This line will paste the link on cell G10 of your sheet A on the original sheet(change the cell if needed)
  sheetA.getRange("G10").setValue(newSpreadsheet.getUrl())
}

This updated code will paste the link of the new sheet on cell G10 of sheet A(see image below) located on your original sheet assuming that your button which you assigned the script to is on Sheet A, do not hesitate to say so if that is not the case.

References: Apps script’s SpreadSheetApp, SpreadsheetApp copyTo()

3

If you don’t need to automatise the process for a large number of spreadsheets, you could simply manually create a new temporary spreadsheet with a copy of the two sheets.

Click on the arrow of (or right-click on) sheet B, then ‘Copy to’ -> ‘New spreadsheet’. Then on sheet C: ‘Copy to’ -> ‘Existing spreadsheet’, and select the previously created spreadsheet containing the copy of sheet B.

Then just download the spreadsheet.

New contributor

user27425627 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật