Learn More India

Google Sheet Invoice Generator with PDF Auto Save

Introduction – क्या आप हर बार Invoice manually बनाते हैं?

क्या आप भी Google Sheet में invoice बनाते हैं…
फिर उसे PDF में export करते हैं…
और फिर Google Drive में upload करते हैं?

अगर हाँ, तो आप रोज़ 10–15 मिनट extra दे रहे हैं।

अब सोचिए…

👉 अगर सिर्फ एक क्लिक में आपका invoice PDF बन जाए
👉 और वो automatic Google Drive में save भी हो जाए
👉 और हर invoice का record folder में properly store हो जाए

तो?

आज हम बिल्कुल वही सीखेंगे —
Google Sheet Invoice Generator with PDF Auto Save using Apps Script

यह वही automation है जो practical demo में दिखाया गया था — real working example के साथ।


📌 Google Sheet Invoice Generator क्या है?

Google Sheet Invoice Generator एक automated system है जिसमें:

  • आप Google Sheet में invoice बनाते हैं
  • एक button पर क्लिक करते हैं
  • Apps Script background में run होती है
  • Invoice का PDF generate होता है
  • Google Drive में auto folder create होता है
  • Invoice PDF वहाँ save हो जाता है

और आपको सिर्फ एक message मिलता है:

“Invoice PDF Saved”

बस. काम खत्म.


🎯 यह Automation क्यों ज़रूरी है?

अगर आप इनमें से कोई हैं:

  • Freelancer
  • Digital Marketer
  • GST Registered Business
  • Coaching Owner
  • CA / Accountant
  • Startup Founder

तो आप जानते हैं कि invoice management कितना repetitive काम है।

Manual process में:

❌ Copy paste
❌ PDF export
❌ Rename
❌ Upload
❌ Folder organize

Automation में:

✅ 1 Click
✅ Auto PDF
✅ Auto Folder Creation
✅ Proper Naming
✅ Error Free System

Google Apps Script code for invoice PDF automation

🧾 Step 1: Google Sheet में Invoice Template बनाना

सबसे पहले आपको Google Sheet में एक invoice template बनाना होगा।

आप दो तरीके से कर सकते हैं:

  1. Blank Sheet से
  2. Template Gallery से

मैं recommend करता हूँ — Blank Sheet से बनाएं।


🏗 Basic Invoice Structure

आपका invoice कुछ इस तरह दिख सकता है:

FieldExample
Invoice No1
Client NameSharma Ram
Date20-02-2026
ProductABC Product
Quantity1
Rate7000
Total7000

नीचे आप add कर सकते हैं:

  • Grand Total
  • Terms & Conditions
  • Bank Details
  • Notes


🎨 Formatting Tips

  • Gridlines hide करें (View → Show → Uncheck Gridlines)
  • Company Logo add करें
  • Company Details add करें
  • Bold headers रखें
  • Clean layout रखें

Professional look बहुत important है।


🔘 Step 2: Button Add करें (Save Invoice Button)

Google Sheet में direct button नहीं होता।

आपको Shape add करना होता है।

Process:

Insert → Drawing → Shape → Rectangle

Shape के अंदर लिखें:

Save Invoice & Create PDF

Save & Close करें।

अब sheet में button जैसा shape आ जाएगा।


💻 Step 3: Apps Script जोड़ना

अब आता है असली automation का भाग।


🔹 Apps Script कैसे खोलें?

  1. Extensions
  2. Apps Script
  3. New Project

अब आपके सामने JavaScript editor खुल जाएगा।

function saveInvoicePDF() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName("INVOICE");

  var folderName = "Invoices PDF";
  var folders = DriveApp.getFoldersByName(folderName);
  var folder = folders.hasNext() ? folders.next() : DriveApp.createFolder(folderName);

  var invoiceNo = sheet.getRange("F10").getValue();
  if (invoiceNo == "") invoiceNo = "INV-" + new Date().getTime();

  // ✅ Export only this range
  var range = sheet.getRange("A1:I32");
  var exportUrl = ss.getUrl().replace(/edit$/, '') +
    "export?format=pdf" +
    "&gid=" + sheet.getSheetId() +
    "&range=" + range.getA1Notation() +
    "&size=A4" +
    "&portrait=true" +
    "&fitw=true" +
    "&sheetnames=false&printtitle=false&pagenumbers=false" +
    "&gridlines=false&fzr=false";

  var token = ScriptApp.getOAuthToken();
  var response = UrlFetchApp.fetch(exportUrl, {
    headers: { 'Authorization': 'Bearer ' + token }
  });

  var pdfBlob = response.getBlob().setName(invoiceNo + ".pdf");
  folder.createFile(pdfBlob);

  SpreadsheetApp.getUi().alert("✅ Invoice PDF saved without shapes!");
}

🧠 Script कैसे काम करती है?

Script 5 मुख्य काम करती है:

  1. Active Sheet detect करती है
  2. Invoice Number cell पढ़ती है
  3. PDF export range define करती है
  4. Drive में folder check करती है
  5. PDF save करती है

🔎 Important चीज़ें ध्यान रखें

1️⃣ Sheet Name Match होना चाहिए

अगर आपकी sheet का नाम “Invoice” है
तो script में भी “Invoice” होना चाहिए।

Mismatch हुआ तो error आएगा।


2️⃣ Invoice Number Cell सही दें

अगर आपका invoice number F10 में है
तो code में reference F10 होना चाहिए।

⚠ Merge cell है तो first column reference दें।


3️⃣ Print Range सही दें

Example:

A1:I32

मतलब A1 से I32 तक PDF बनेगा।

Range गलत होगी तो half invoice कट सकता है।


🔐 First Time Authorization क्यों आता है?

जब आप पहली बार script run करते हैं:

Google पूछता है:

“Allow this app to access your Drive?”

क्यों?

क्योंकि:

  • Script file create करेगी
  • Drive में folder बनाएगी
  • PDF save करेगी

यह normal है।

Excel VBA में भी security warning आती है।


📂 Drive में Auto Folder Creation

Script automatically:

  • Drive में “Invoice PDF” नाम का folder बनाती है
  • अगर folder already है तो use करती है
  • हर invoice को अलग PDF के रूप में save करती है

Example:

Invoice_1.pdf
Invoice_2.pdf


🧾 Practical Example

मान लीजिए:

पहला Invoice:

Invoice No: 1
Client: Sharma Ram
Amount: ₹7000

Click → Save Invoice

Result:

Drive में Invoice_1.pdf


दूसरा Invoice:

Invoice No: 2
Client: Learn More
Amount: ₹15000

Click → Save Invoice

Result:

Drive में Invoice_2.pdf

Automation working perfectly.


⚠ Common Mistakes (यह गलती मत करना!)

  1. Sheet rename नहीं किया
  2. Project name को function name समझ लिया
  3. Wrong function assign किया
  4. Folder permission deny कर दिया
  5. Print range छोटा रखा

सबसे common गलती:

❌ Project Name assign कर देना
✔ Function Name assign करना चाहिए


🔥 Pro Tips (Advanced Users के लिए)

  • Invoice Number auto increment formula लगाएं
  • Due Date = Today + 7 formula लगाएं
  • Timestamp add करें
  • Email auto send integrate करें
  • PDF link sheet में auto paste करें

📊 Manual vs Automated Invoice

FeatureManualAutomated
Time10–15 min10 sec
Folder CreateManualAuto
Error ChanceHighLow
ScalabilityLowHigh
Professional LevelMediumAdvanced

❓ FAQs

Q1: क्या Google Sheet से PDF auto generate हो सकता है?

हाँ, Google Apps Script से invoice PDF automatically generate किया जा सकता है।

Q2: क्या यह method free है?

हाँ, Google Sheet और Apps Script दोनों free हैं।

Q3: क्या इसमें email auto send कर सकते हैं?

हाँ, GmailApp function से email automation जोड़ सकते हैं।

Q4: क्या merged cells में invoice number detect होगा?

हाँ, लेकिन first column reference देना होगा।

Q5: क्या mobile से यह setup हो सकता है?

Setup desktop से करें, use mobile से कर सकते हैं।

Q6: क्या multiple clients handle कर सकते हैं?

हाँ, हर invoice अलग PDF बनकर Drive में save होगा।

Free GST Invoice Maker Tool – सरल और प्रभावी