You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何高效将100张图片分别插入Google Docs的100个独立页面?

Got it, inserting 100 images one per page manually is such a time-suck—let’s cover two efficient solutions to get this done fast, whether you prefer code or no-code approaches!

方法1:Google Apps Script自动化(最高效,推荐)

This method lets you automate the entire process with a simple script, perfect for large batches like 100 images.

步骤:

  1. Prepare your images: Upload all 100 images to a single Google Drive folder. For easier sorting, name them sequentially (e.g., img_001.jpg, img_002.jpg...). Grab the folder ID from the Drive URL (it’s the long string after folders/ in the address bar).
  2. Open the script editor: In your Google Docs document, go to Extensions > Apps Script to launch the editor.
  3. Replace the default code: Paste the script below, then update the FOLDER_ID, PAGE_WIDTH, and PAGE_HEIGHT values to match your needs (default is A4 size).
  4. Run the script: Save the project (name it something like "Image Per Page Importer"), click the run button ▶️, and grant the necessary permissions (Google will warn you it’s an unverified app—this is safe since you wrote it yourself; just follow the "Advanced" link to proceed).
function insertImagesPerPage() {
  // 配置参数
  const FOLDER_ID = "YOUR_DRIVE_FOLDER_ID_HERE"; // 替换成你的图片文件夹ID
  const PAGE_WIDTH = 595; // A4宽度(像素),可根据你的文档调整
  const PAGE_HEIGHT = 842; // A4高度(像素)
  const MARGIN = 40; // 边距,避免图片贴边

  const doc = DocumentApp.getActiveDocument();
  const body = doc.getBody();
  const folder = DriveApp.getFolderById(FOLDER_ID);
  const files = folder.getFilesByType(MimeType.JPEG) // 可根据图片类型修改,比如PNG
    .sort((a, b) => a.getName().localeCompare(b.getName())); // 按文件名排序

  // 清空现有内容(可选,根据你的需求调整)
  body.clear();

  while (files.hasNext()) {
    const file = files.next();
    const imageBlob = file.getBlob();
    
    // 插入图片并调整大小适配页面
    const image = body.appendImage(imageBlob);
    image.setWidth(PAGE_WIDTH - 2 * MARGIN);
    image.setHeight((PAGE_WIDTH - 2 * MARGIN) * image.getHeight() / image.getWidth()); // 保持宽高比
    
    // 在图片后插入分页符(最后一张图片不需要)
    if (files.hasNext()) {
      body.appendPageBreak();
    }
  }
}

自定义提示:

  • If your images are PNGs, change MimeType.JPEG to MimeType.PNG in the script.
  • If you don’t want to clear existing content, remove the body.clear(); line.
  • To sort images by upload date instead of filename, replace the sort line with .sort((a, b) => b.getDateCreated() - a.getDateCreated()).
方法2:无代码批量导入+快速分页

If you’re not comfortable with scripts, this manual-but-fast method works too:

步骤:

  1. Organize local images: Put all 100 images in a single folder on your computer, named sequentially (e.g., img1 to img100) so they import in order.
  2. Batch import images: Open your Google Docs, delete any existing content (if needed), then go to Insert > Images > Upload from computer. Select all 100 images at once—they’ll all insert into the document in a single continuous block.
  3. Resize images (if needed): Select all images (drag to highlight or press Ctrl+A), right-click one, choose Size and position, and set the width to match your page width minus margins (e.g., 6.5 inches for A4 with 0.5-inch margins).
  4. Quickly add page breaks: Place your cursor right after the first image, press Ctrl+Enter (Windows) or Cmd+Enter (Mac) to insert a page break. Then press Ctrl+Y (Windows) or Cmd+Y (Mac) repeatedly—this repeats the last action (inserting a page break) and will automatically jump to the end of the next image each time. Do this 99 times and you’ll have each image on its own page!

Pro tip:

If you find pressing Ctrl+Y 99 times tedious, you can use a keyboard macro tool (like AutoHotkey on Windows or Keyboard Maestro on Mac) to automate the repeat action.

内容的提问来源于stack exchange,提问作者Yash Pathak

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.13 07:39:38