export-as
September 17, 2025 ยท View on GitHub
Sheet Exporter ~ Google Apps Script project that reads data from a Google Sheet and creates a new Google Sheet and an Excel (.xlsx) file in your Google Drive.
Setup Instructions
- Open any Google Sheet (create a new one if needed).
- Go to Extensions > App Script.
- Delete any code in
Code.gsand paste the contents ofCode.gsfrom this repo. - Save the code. You can simply press
Ctrl+Sto save.
How to Run
- In the Apps Script editor, select
writeSheetFilefrom the function dropdown, then clickRunto execute it. - The first time you run it, Google will ask for authorization. Accept the permissions.
- Once finished, the data will be exported to a new Google Sheet and an Excel file in your Google Drive.
Configuration
- In
Code.gsin Apps Scripts, locate the following line and update it:
// ๐ Modify this to the sheet you want to export from
const sourceSheetName = "Sheet1";
- You can also modify the base name of the exported files:
// ๐ Modify this to customize the base name of the exported files
const baseFileName = "Exported_Data";
Output
- Data from the source sheet will be written to the new Google Sheet.
- An Excel
(.xlsx)file will also be created in your Google Drive with the same content. - Timestamps in filenames ensure uniqueness.
Limitations
- The script exports the entire content of the source sheet. Partial ranges are not configurable in this version.
- It does not interact with external websites or perform web scraping.
- For extracting tables from webpages, refer to the scraper-as project.
These two projects work best together:scraper-ascan populate a sheet with web table data, whichexport-ascan then export to new sheets or Excel files. - Requires the source sheet to exist and contain data.
Notes
- This project is an upgrade from the previous
vba-filerepo. Since VBA is approaching the end of its mainstream support and requires Excel for execution. - This Google Apps Script version provides a more stable, modern, and free solution for exporting data from Google Sheets.
- This project is designed to be simple, lightweight, and entirely free to use with Google Sheets.
- We retain
Module.basin the repository for anyone who wishes to continue using the legacy VBA version.
๐งพ License
MIT โ do whatever you want with it.
โจ Happy coding! If you find this project useful, a โญ on the repo is always appreciated!