Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Python can capture an Excel spreadsheet’s appearance only after something has rendered it. An .xlsx file contains workbook data and formatting; it is not a picture. If the spreadsheet is already open in a browser, Playwright can capture the rendered page or a specific element. If it is a local workbook, first open or render it in an office application, then use an appropriate capture or export method for your operating system and application.
openpyxl can read and write workbook files, but it does not render a worksheet into a screenshot. The browser example below is runnable for a spreadsheet already displayed at a web URL; it does not open an arbitrary Excel file.
Choose the right route for your spreadsheet
Start by identifying what you need to photograph: a web page displaying a spreadsheet, or a workbook file on your computer. The distinction determines what Python can capture.
| Situation | Suitable route | Important constraint |
|---|---|---|
| The spreadsheet is already displayed in a browser | Use Playwright to capture the browser page or a selected element. | Playwright captures rendered browser content, not an arbitrary workbook file. See the Playwright Python screenshots documentation. |
You have a local .xlsx workbook and want an application view |
Open it in an office application, then capture or export the displayed result using a method appropriate to your platform and application. | The LibreOffice SDK examples include Python and spreadsheet automation examples, but do not provide a universal worksheet-to-PNG recipe. |
| You need to inspect or change workbook data before displaying it | Use openpyxl for workbook operations, then render the workbook separately. |
openpyxl is not a screenshot renderer; some workbook content may not be preserved if you save after loading it. |
Capture a spreadsheet already rendered in a browser
Playwright’s Python screenshot API can save a rendered page, capture its full scrollable extent, or take a screenshot of one element. Install Playwright and its browser before running the script:
#1 Best Overall
- FULL HD IPS DISPLAY - Enjoy vibrant, crystal-clear images with 178-degree wide-viewing angles
- AMD RYZEN 3 30 PROCESSOR - Everyday performance you can count on; Multitask, stream, game casually, and edit photos smoothly with responsive power and vibrant HDR visuals
- ENJOY UP TO 14 HOURS AND 15 MINUTES OF BATTERY LIFE - HP Fast Charge restores battery from 0 to 50% in approximately 45 minutes
- AMD RADEON 610M GRAPHICS - Experience smooth entertainment; Built for streaming and multitasking, enjoy realistic visuals and efficient performance for work and play
- STORAGE AND MEMORY - 512 GB PCIe NVMe M.2 SSD offers fast speed and efficient storage; and 8 GB LPDDR5 RAM memory boosts performance with higher bandwidth
python -m pip install playwrightpython -m playwright install chromium- Save the code below as
capture_spreadsheet.py, replace the example URL with the page that displays your spreadsheet, then runpython capture_spreadsheet.py.
from pathlib import Path
from playwright.sync_api import sync_playwright
URL = "https://example.com/spreadsheet"
OUTPUT = Path("spreadsheet.png")
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
page = browser.new_page(
viewport={"width": 1440, "height": 1000},
device_scale_factor=1,
)
response = page.goto(URL, wait_until="networkidle", timeout=60_000)
if response is not None and response.status >= 400:
raise RuntimeError(f"Page returned HTTP {response.status}: {URL}")
page.screenshot(path=str(OUTPUT), full_page=True)
browser.close()
print(f"Saved screenshot to {OUTPUT.resolve()}")
The script saves a PNG of the full browser page. If the page keeps making network requests, networkidle may take too long or never occur; wait for a spreadsheet-specific element instead (examples follow), or use a deliberate delay when the page’s loading behavior is understood. The browser must also be able to access the page: sign-in, access controls, and client-side application state may require additional setup.
Capture only the spreadsheet element
When the page contains navigation, toolbars, or unrelated content, target the spreadsheet container rather than the whole page. Inspect the page to find a stable CSS selector for the element, then replace .spreadsheet below with that selector:
from playwright.sync_api import sync_playwright
URL = "https://example.com/spreadsheet"
SELECTOR = ".spreadsheet"
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
page = browser.new_page(viewport={"width": 1440, "height": 1000})
page.goto(URL, wait_until="domcontentloaded", timeout=60_000)
sheet = page.locator(SELECTOR)
sheet.wait_for(state="visible", timeout=30_000)
sheet.screenshot(path="spreadsheet-element.png")
browser.close()
Element screenshots are useful when the spreadsheet is a self-contained visible region. They do not automatically include portions hidden by the element’s own scrolling or virtualized rows. If the application only renders rows as they enter view, a full-page screenshot may still omit rows that were never rendered; use the application’s own export or a workflow that exposes the required content.
Wait for data, not just page navigation
A browser navigation finishing does not necessarily mean the spreadsheet contents are ready. If you know a cell, heading, or status element that appears after loading, wait for that element:
Rank #2
- Intel Celeron N4120: 4 Cores & Threads, 1.1GHz Base Clock, Up to 2.6GHz Boost Clock, 4MB Cache, Intel UHD Graphics 600. The perfect combination of performance, power consumption, and value helps your device handle multitasking smoothly and reliably with four processing cores to divide up the work.
- 14" HD Display: 14.0-inch diagonal, HD (1366 x 768), micro-edge, anti-glare. See your digital world in a whole new way. Enjoy movies and photos with the great image quality and high-definition detail of 1 million pixels.
- Memory & Storage: 4 GB LPDDR4x & 64 GB eMMC Storage. Adequate high-bandwidth RAM to smoothly run multiple applications and browser tabs all at once. An embedded multimedia card provides reliable flash-based storage.
- Ports:2 x USB 3.0 Type-A,1 x USB 3.0 Type-C,1 x HDMI,1 x Headphone Jack
- Chrome OS: Chromebook is a computer for the way the modern world works, with thousands of apps. Enjoy the seamless simplicity that comes with Google Chrome and Android apps, all integrated into one laptop. It’s fast, simple, and secure.
page.goto(URL, wait_until="domcontentloaded", timeout=60_000)
page.locator("text=Quarterly revenue").wait_for(
state="visible", timeout=30_000
)
page.screenshot(path="spreadsheet.png", full_page=True)
Replace the example text with content that is actually present on your page. For a more stable automation, wait for a selector specific to the spreadsheet or for the application’s own ready state. A fixed delay can be a fallback, but it may be too short on a slow connection and unnecessarily long on a fast one.
Return screenshot bytes instead of writing a file
Playwright can also return the screenshot bytes, which is useful if your program sends the image to another service or stores it itself:
image_bytes = page.screenshot(full_page=True)
# image_bytes is PNG data; write it or pass it to your next step.
For a file, prefer the documented path= option. For an element screenshot, call screenshot() on the matching locator. The API supports page, full-page, byte-buffer, and element capture as described in the Playwright screenshots guide.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchCapture a local Excel workbook
A local workbook must be rendered by an office application before Python can capture its appearance. This matters when the goal is to preserve how the sheet looks in an application: column widths, fonts, page layout, formula results, and other visual details belong to the rendered view, not to a screenshot API for the raw workbook.
Rank #3
- Stunning 15.6" FHD IPS Display: Experience crisp 1920x1080 resolution on this 15.6 inch laptop with an IPS panel that delivers wide viewing angles and vivid colors. The narrow-bezel design maximizes screen real estate for comfortable viewing on this Win 11 laptop, whether you're studying or working.
- Celeron J4105 Processor & 256GB SSD: Powered by a reliable Celeron J4105 processor paired with 12GB DDR4 memory and a fast 256GB M.2 SSD. This laptop computer supports SSD expansion up to 2TB and TF card expansion up to 1TB, so your storage grows with your needs. Delivers smooth multitasking for daily productivity.
- AI-Powered Win 11 Laptop: Built-in AI features enhance your productivity with smart assistance for writing, summarizing, and task management. Pre-installed with Win 11 and includes Office 365 subscription. This student laptop is backed by 1-year warranty and 24/7 customer support.
- All-Day 7000mAh Battery & 180° Hinge: The high-capacity 7000mAh battery keeps this laptop powered through long classes or meetings. The 180-degree lay-flat hinge lets you share your screen effortlessly during presentations. This durable laptop computer adapts to your dynamic workflow.
- Versatile Connectivity Hub: Equipped with USB 3.2, Type-C, Mini HDMI, and 3.5mm audio jack to connect all your peripherals. Stay online anywhere with high-speed 5G WiFi and Bluetooth 4.2. This college laptop keeps you connected at home, in the library, or on the go.
LibreOffice provides Python and spreadsheet automation examples in its SDK examples. Those examples establish an office-automation route, but do not document a single end-to-end Python recipe that produces a worksheet screenshot on every operating system. The exact way to open the workbook, display the desired sheet and range, and capture or export the result depends on the installed application and environment. For a faithful Excel desktop view, use Excel itself; for a LibreOffice view, use LibreOffice and check the result in that application.
Before capture, set the workbook to the intended sheet and view, adjust zoom and visible range, and ensure the relevant cells have finished calculating. Then capture the application’s visible output using a platform-appropriate desktop capture method, or use an export format that suits the purpose. A desktop screenshot records what is visible; it may not include rows or columns outside the window. An export can produce a different layout from the current on-screen view, so inspect the resulting image or document rather than assuming it matches the screen.
Where openpyxl fits—and where it does not
The openpyxl tutorial documents loading and saving workbook files, including the effect of data_only when reading formulas. It does not describe rendering a worksheet as an image. Use it for tasks such as reading cell values or editing workbook content, not as the step that takes the screenshot.
Recommended Free Tools
Be cautious about saving an important workbook after editing it with a library. The tutorial warns that not every Excel item is supported, and specifically notes that shapes may be lost when a workbook is opened and saved. Work on a copy and check that the content you care about remains intact. For the same reason, avoid treating an openpyxl round trip as a harmless prerequisite to capturing a picture.
Rank #4
- Efficient Performance for Everyday Computing: Powered by Intel N150 processor with up to 3.6 GHz Intel Turbo Boost Technology, 6 MB L3 cache, 4 cores, and 4 threads, this HP laptop delivers responsive performance for web browsing, streaming, document editing, and multitasking. Paired with 4GB LPDDR5 RAM and 128GB UFS storage, it handles daily tasks smoothly. Includes 1-year Microsoft 365 Personal subscription for Word, Excel, PowerPoint, and cloud storage to maximize your productivity.
- 14-Inch HD Micro-Edge Display:Enjoy clear visuals on the 14-inch HD (1366 x 768) anti-glare screen with 250-nit brightness and 62.5% sRGB coverage. The micro-edge bezel delivers a 79% screen-to-body ratio in a compact design. An HP True Vision 720p HD camera with noise reduction and dual-array microphones supports clear video calls, remote work, and online learning.
- Modern Connectivity and Wireless Technology: Stay connected with Wi-Fi 6 (2x2) for faster wireless speeds and Bluetooth 5.4 for seamless pairing with accessories. Versatile port selection includes 1 USB Type-C 10Gbps with DisplayPort 1.2 for external displays, 2 USB Type-A 5Gbps ports for peripherals, 1 HDMI 1.4b port, 1 headphone/microphone combo jack, and 1 multi-format SD media card reader. Connect monitors, transfer files quickly, and expand your workspace with ease.
- All-Day Battery Life and Portable Design: Enjoy up to 11 hours of video playback, 7.5 hours of mixed usage, or 7.5 hours of wireless streaming on a single charge, perfect for students and professionals on the go. Weighing just 3.24 lb and measuring 12.76" x 8.86" x 0.71", this lightweight laptop fits easily in backpacks and bags. The stylish willow green top cover with matte finish and natural silver keyboard deck with vertical brushing pattern offer a modern, professional look.
- AI-Enhanced Productivity: Access Microsoft Copilot instantly with the dedicated Copilot key for faster assistance. AI Noise Reduction filters background sounds and improves voice clarity during calls. Dual speakers provide clear audio, while the full-size natural silver keyboard and HP Imagepad support comfortable typing and navigation.
The separate openpyxl image documentation shows how to add an existing image file to a worksheet. That is the reverse direction from this task: inserting an image into a workbook does not capture the workbook’s displayed appearance.
Make the screenshot useful and legible
- Choose the scope. Use a page screenshot for the whole browser view,
full_page=Truefor the full page extent, or an element screenshot for a specific sheet region. - Set a suitable viewport. Choose a width and height that show the columns and rows the reader needs. A wider viewport can avoid wrapping or horizontal clipping, but does not guarantee that a web app has rendered off-screen data.
- Wait for the actual content. Confirm that the relevant sheet and values are visible before capturing; a successful navigation alone is not proof that a dynamic spreadsheet finished loading.
- Inspect the output. Open the image and check that the intended sheet and range appear, labels are readable, and no dialog, menu, loading indicator, or unrelated browser content obscures the result.
- Keep originals safe. If you use a workbook library to inspect or edit a valuable file, work from a copy and verify the saved workbook, especially if it contains features beyond ordinary cells.
Troubleshooting common capture failures
The output file is blank or shows a loading screen
The page may have been captured before the spreadsheet rendered, or it may require a signed-in session. Wait for a spreadsheet-specific selector or visible cell content before taking the screenshot. If access depends on authentication, provide the session through the application’s supported login flow rather than assuming that a blank page is a screenshot failure.
The screenshot is missing rows or columns
A viewport screenshot captures only what is visible, while a full-page screenshot concerns the browser page’s scrollable extent. Neither guarantees that a spreadsheet application rendered every row: some web spreadsheets virtualize content and only create visible rows. Scroll or use the application’s own export or capture capability when the full dataset is required.
Free tools Windows power users keep installed
One-click scans. No signup required.
The selector is not found
The selector may not match the page, may be inside an iframe, or may refer to content that appears only after another action. Inspect the rendered page, use a selector for the actual spreadsheet container, and wait for it to become visible. If the spreadsheet is embedded, the page’s structure and access rules affect whether it can be targeted.
Best Value
- Efficient Intel Processor: Powered by Intel Celeron 5205U dual-core two-thread processor with a fixed 1.9GHz base frequency, 2MB Intel Smart Cache and advanced 14nm Comet Lake lithography. Integrated Intel UHD Graphics for 10th Gen Intel Processors delivers stable daily performance. It handles daily office tasks, web browsing, video streaming and light multitasking smoothly while featuring ultra-low power consumption for extended use.
- Fast Response Large Storage:Equipped with 12GB high-speed RAM to accelerate program loading and enable seamless multitasking. Built-in 256GB solid-state drive provides rapid boot and application launch speeds, offering ample storage space for your documents, software, photos and videos. Run daily productivity and multimedia applications without lag or slowdowns.
- 15.6" FHD IPS Eye-Care Display:This laptop features a 15.6-inch Full HD IPS panel with native 1920×1080 resolution and classic 16:9 widescreen ratio. Designed with slim 5mm ultra-narrow bezels, anti-glare coating and blue light filtering eye protection, it effectively reduces eye strain during long hours of studying, streaming or working, delivering vivid, immersive visual experiences. effectively reduce blue light and eye strain, bringing you immersive visual experience for watching videos and studying.
- Pre‑Installed Windows 11: Ready to Use Comes with a genuine Windows 11 system pre‑loaded, offering a clean, intuitive interface and broad software compatibility. Open the box, power on, and you're all set for school assignments, business reports, or daily computing needs.
- Rich Ports & Long Lasting Battery Life:Built-in 38Wh rechargeable battery and dual stereo speakers. Support Bluetooth 4.2 & 2.4G/5G dual-band WiFi for fast wireless connection. Equipped with Type-C, HDMI, 3.5mm audio jack, dual USB 3.0, Micro TF slot and DC charging port, meet your daily external device connection and office expansion needs.
The workbook looks different after using openpyxl
Workbook libraries do not necessarily preserve every Excel feature. Avoid saving the original through a library when preservation matters; work on a copy and compare it in the office application. The openpyxl tutorial specifically warns about unsupported items and possible shape loss on save.
Playwright times out while waiting for network idle
Some pages keep background connections active, so network inactivity may not arrive. Wait for a known spreadsheet element instead, use a shorter navigation condition such as domcontentloaded, and then wait for the page-specific content. Increase the timeout only when the page legitimately needs more time; a larger timeout does not fix a missing selector or access failure.
Or skip the browser setup
If the spreadsheet is already published at a URL that can be opened publicly, ScreenshotNeo can capture the rendered page with one request. This does not upload or render a local .xlsx file; it captures a web page. See the ScreenshotNeo website and API documentation for request options.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/spreadsheet -o shot.webp
Cookie banners, newsletter popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and the Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for free.
Frequently Asked Questions
Can Python take a screenshot directly from an .xlsx file without opening it?
Not with the screenshot workflow described here. The workbook has to be rendered by an office application or a browser-based spreadsheet before a capture tool can record its appearance.
Does Playwright capture the entire workbook when I set full_page=True?
It captures the browser page’s full scrollable extent, not necessarily every workbook row. Web applications that render only visible rows may require a different export or capture approach.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

