<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Victor Feitosa</title>
    <description>The latest articles on Forem by Victor Feitosa (@greypv).</description>
    <link>https://forem.com/greypv</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3930298%2Fdfee849a-d747-408d-a016-2bbb7538f41c.jpg</url>
      <title>Forem: Victor Feitosa</title>
      <link>https://forem.com/greypv</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/greypv"/>
    <language>en</language>
    <item>
      <title>How to Merge Multiple Excel Files into One with Python</title>
      <dc:creator>Victor Feitosa</dc:creator>
      <pubDate>Thu, 21 May 2026 01:43:56 +0000</pubDate>
      <link>https://forem.com/greypv/how-to-merge-multiple-excel-files-into-one-with-python-5f10</link>
      <guid>https://forem.com/greypv/how-to-merge-multiple-excel-files-into-one-with-python-5f10</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Every month, the same thing happens &lt;span class="k"&gt;in &lt;/span&gt;offices everywhere:
someone has to open 12 monthly reports and manually copy everything into a master file.

I built a Python tool that eliminates this entirely.

&lt;span class="c"&gt;## What it does&lt;/span&gt;

python merge_excel.py ./reports

It finds every .xlsx file &lt;span class="k"&gt;in &lt;/span&gt;the folder, reads them all, stacks the data,
and exports one clean formatted spreadsheet — with a &lt;span class="s2"&gt;"Source File"&lt;/span&gt; column
showing exactly where each row came from.

&lt;span class="c"&gt;## The core — pd.concat&lt;/span&gt;

The key &lt;span class="k"&gt;function &lt;/span&gt;is pandas&lt;span class="s1"&gt;' concat. It stacks DataFrames from different files
even when columns don'&lt;/span&gt;t match perfectly — missing columns are filled automatically.

import pandas as pd
from pathlib import Path

def merge_files&lt;span class="o"&gt;(&lt;/span&gt;folder&lt;span class="o"&gt;)&lt;/span&gt;:
    files &lt;span class="o"&gt;=&lt;/span&gt; sorted&lt;span class="o"&gt;(&lt;/span&gt;Path&lt;span class="o"&gt;(&lt;/span&gt;folder&lt;span class="o"&gt;)&lt;/span&gt;.glob&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"*.xlsx"&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt;
    frames &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[]&lt;/span&gt;

    &lt;span class="k"&gt;for &lt;/span&gt;f &lt;span class="k"&gt;in &lt;/span&gt;files:
        &lt;span class="nb"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; pd.read_excel&lt;span class="o"&gt;(&lt;/span&gt;f, &lt;span class="nv"&gt;engine&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"openpyxl"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        df.insert&lt;span class="o"&gt;(&lt;/span&gt;0, &lt;span class="s2"&gt;"Source File"&lt;/span&gt;, f.name&lt;span class="o"&gt;)&lt;/span&gt;
        frames.append&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;df&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

    merged &lt;span class="o"&gt;=&lt;/span&gt; pd.concat&lt;span class="o"&gt;(&lt;/span&gt;frames, &lt;span class="nv"&gt;ignore_index&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;True, &lt;span class="nb"&gt;sort&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;False&lt;span class="o"&gt;)&lt;/span&gt;
    merged.fillna&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;, &lt;span class="nv"&gt;inplace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;True&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return &lt;/span&gt;merged

That&lt;span class="s1"&gt;'s the core. The rest is formatting and CLI handling.

## The full tool

The complete script adds:
- Auto-detection of files (folder or explicit list)
- Professional Excel formatting (headers, alternating rows, frozen pane)
- Clean terminal output showing progress

GitHub: github.com/grey-pv/excel-merger

## What'&lt;/span&gt;s next

This is project &lt;span class="c"&gt;#2 of a Python automation toolkit I'm building in public.&lt;/span&gt;
Each project solves one specific data problem. Next up: CSV Cleaner.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>automation</category>
      <category>pandas</category>
      <category>productivity</category>
    </item>
    <item>
      <title>I built a Python tool that extracts tables from PDFs and exports to Excel automatically</title>
      <dc:creator>Victor Feitosa</dc:creator>
      <pubDate>Sat, 16 May 2026 23:51:29 +0000</pubDate>
      <link>https://forem.com/greypv/i-built-a-python-tool-that-extracts-tables-from-pdfs-and-exports-to-excel-automatically-3gaj</link>
      <guid>https://forem.com/greypv/i-built-a-python-tool-that-extracts-tables-from-pdfs-and-exports-to-excel-automatically-3gaj</guid>
      <description>&lt;p&gt;Every week I saw the same thing at work: someone opening a PDF, manually copying a table into Excel, cell by cell. 30 minutes of work that should take 2 seconds.&lt;/p&gt;

&lt;p&gt;So I built a tool to fix it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python extract_tables.py financial_report.pdf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. You get a formatted &lt;code&gt;.xlsx&lt;/code&gt; file with every table from the PDF, organized into separate sheets with styled headers, alternating rows, and auto-fitted columns.&lt;/p&gt;

&lt;h2&gt;
  
  
  The tech stack
&lt;/h2&gt;

&lt;p&gt;Three libraries. That's all:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;pdfplumber&lt;/strong&gt; — opens the PDF and extracts table data page by page&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pandas&lt;/strong&gt; — structures the raw data into DataFrames&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;openpyxl&lt;/strong&gt; — writes to Excel with formatting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No OCR. No Java. No external APIs. Pure Python.&lt;/p&gt;

&lt;h2&gt;
  
  
  The core extraction — 15 lines
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pdfplumber&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;extract_tables_from_pdf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pdf_path&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;pdfplumber&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pdf_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pdf&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;page_num&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pdf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;tables&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;extract_tables&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t_idx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;raw_table&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tables&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                &lt;span class="n"&gt;header&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;raw_table&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
                &lt;span class="n"&gt;rows&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;raw_table&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:]&lt;/span&gt;
                &lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;columns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;header&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;page&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;page_num&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;table_index&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;t_idx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;dataframe&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;pdfplumber does the heavy lifting. It detects table boundaries from the PDF's internal structure — no guessing, no heuristics for basic cases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it's useful for real work
&lt;/h2&gt;

&lt;p&gt;PDF reports are everywhere: government data, supplier invoices, financial statements, logistics documents. Most of them have tables. None of them are easy to work with.&lt;/p&gt;

&lt;p&gt;This tool is for the analyst who gets a 20-page PDF every Monday morning and needs the data in Excel by 9am.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get the full code
&lt;/h2&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/grey-pv/pdf-to-excel" rel="noopener noreferrer"&gt;github.com/grey-pv/pdf-to-excel&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Includes the full CLI script, a sample PDF generator for testing, and instructions to run it in under 2 minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's coming next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Batch mode for processing multiple PDFs at once&lt;/li&gt;
&lt;li&gt;Streamlit UI for non-technical users&lt;/li&gt;
&lt;li&gt;OCR support for scanned PDFs&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;This is part of a Python automation toolkit I'm building in public. If you work with PDFs regularly, try it and let me know what breaks — real-world PDFs are always messier than test cases.&lt;/p&gt;

</description>
      <category>python</category>
      <category>automation</category>
      <category>productivity</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
