I have a google sheet having 110,000 rows and 10 columns.
If I try to export using the normal File > Download > As PDF, it takes forever to make the Save button work (The ~4800 pages of the PDF keeps rendering and on a premature save, nothing happens) I have done this on Chrome, Firefox and Edge browser, just to see if changing browser would make a difference.
Then I tried using app-script, but the ones available on the WebApp StackExchange did not work.
I know the solution will be with an app script code. What is the best solution for me to able to export the 1 million cell sized sheet to a PDF easily.
EDIT:
As per the comments below I did execute the 8 line code in the newer app script console of Google,
function saveAsPDF() {
const folderName = `Cubing`;
const fileNamePrefix = `filename`;
DriveApp.getFoldersByName(folderName)
.next()
.createFile(SpreadsheetApp.getActiveSpreadsheet()
.getBlob()
.getAs(`application/pdf`)
.setName(`${fileNamePrefix} - ${Utilities.formatDate(new
Date(), `GMT-8`, `yyyy-MM-dd`)}`));
}
But I got a message which is not related to the code.
The execution log said,
Exception: We're sorry, no servers are currently available. Please wait a bit and try again.
saveAsPDF @ Code.gs:7
const folderName
,const fileNamePrefix
andconst fileNamePrefix
) are are defined between backticks rather than single (or double) quotes. Also.setName(
${fileNamePrefix} - ${Utilities.formatDate(new Date(),GMT-8
,yyyy-MM-dd
)}));
contains more backticks and is presenting as two lines rather than one long line. Try those changes and see what happens.