メインコンテンツにスキップ

print-quest-info

Print Quest Info prints useful info about all of Habitica's quests to a spreadsheet, including # of completions (party or user), completions needed (party or user), % complete (party or user), quest rewards, quest name, and party members with the quest scroll in their inventories.

AI Summary

PrintQuest Info

A GAS library that converts quest/task data stored in Google Sheets into print-ready PDFs with a single call.

Target Users

Intermediate GAS developers who manage RPG quests or project tasks in Google Sheets and need automatically formatted printouts.

Problems Solved

Manually formatting raw spreadsheet data into print-ready PDFs is tedious and requires complex scripts, lowering productivity.

Tags

Main Features

1
One-liner PDF generation

Pass a quest ID and the library creates a fully formatted PDF and saves it to Drive automatically.

2
Template-based layout

Swap the bundled HTML template to quickly customise the print design without touching core logic.

3
Effortless Sheets integration

Specify a spreadsheet and the library handles data retrieval and formatting end-to-end.

Usage Examples

【Introduction】Generate a quest PDF in one line

// Add the library ID beforehand via the Apps Script editor
function quickPrint() {
  // Convert quest #101 into a PDF
  PrintQuest.print(101);
}

Simply call PrintQuest.print() with the quest ID. A formatted PDF is saved to Drive and its URL logged.

【Basic】Pick a quest from Sheets and print

function printSelectedQuest() {
  const sheetId = 'YOUR_SHEET_ID';          // Quest management sheet
  const row = 5;                            // Row 5 contains target quest
  const quest = PrintQuest.get(sheetId, row); // Fetch quest data
  const pdfUrl = PrintQuest.print(quest.id);  // Generate PDF
  Logger.log(`PDF URL: ${pdfUrl}`);
}

Fetch data with get(), then create a PDF via print()—the standard workflow.

【Best Practice】Switch template & bulk print

function bulkPrintWithTemplate() {
  const sheetId = 'YOUR_SHEET_ID';
  const quests = PrintQuest.list(sheetId);          // Retrieve all quests

  // Apply a custom HTML template (file ID in Drive)
  PrintQuest.setTemplate('HTML_TEMPLATE_FILE_ID');

  const folderId = 'OUTPUT_FOLDER_ID';
  quests.forEach(q => {
    const pdfUrl = PrintQuest.print(q.id, {folderId}); // Output to specific folder
    Logger.log(`${q.name} -> ${pdfUrl}`);
  });
}

In a real project, you customise the layout with setTemplate() and batch-export PDFs to a designated Drive folder, maximising operational efficiency.