Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7550011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:06:18+00:00 2026-05-30T10:06:18+00:00

I have a large excel file that is used to aggregate tracking for issues

  • 0

I have a large excel file that is used to aggregate tracking for issues across multiple clients and I need to divide it into smaller files based on the clients.

Here’s what I’ve got so far: I’ve built a python script that divides the file into the appropriate client-specific files and applies the correct header row to all of them, but it produces CSVs which are ugly. My boss wants to apply some formatting, so what I need to do is (for all CSVs in the directory):

  1. convert each file from CSV to .xls (or .xlsx) so it will hold the formatting

  2. Auto-fit column widths

  3. Make the first row bold (and perhaps apply a color to the row)

So far I’m guessing I can probably do this with either pyWin32 or pyExcelerator, but considering how minimal the changes I’m looking to make are it may be easier to do this as a VB script or a macro or something, but I don’t really know those tools.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:06:19+00:00Added an answer on May 30, 2026 at 10:06 am

    The simplest way would be to use VBA

    Here’s a quick macro to loop thriugh a folder of csv’s open, apply autofit and save as .xlsx

    Note:

    1. It utilises early binding, therefore requires a reference to the Scripting Runtime. Can easily be altered to late binding if you prefer.
    2. For clarity I have ommitted error handling and various speed optimisations. Whether it’s safe enough or fast enough will depend on your intended use and number and size of files.

    Sub FormatCSVs()
        Dim fso As FileSystemObject
        Dim pth As String
        Dim fl As File
        Dim wb As Workbook
        
        Set fso = New FileSystemObject
        pth = "C:\Test" ' <-- replace with your path, or add a folder selection dialog>
        For Each fl In fso.GetFolder(pth).Files
           If StrComp(fso.GetExtensionName(fl.Path), "csv", vbTextCompare) = 0 Then
                Set wb = Workbooks.Open(fl.Path)
                With wb.Sheets(1)
                    .UsedRange.EntireColumn.AutoFit
                    .Rows(1).Font.Bold = True
                    .Rows(1).Interior.ColorIndex = 3
                End With
                wb.SaveAs pth & "\" & fso.GetBaseName(fl.Path), xlOpenXMLWorkbook
                   ' or use xlExcel8 for .xls
                wb.Close
            End If
        Next
        
        Set fl = Nothing
        Set fso = Nothing
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a really large excel file and i need to delete about 20,000
I have a large VBA script file that references the cells of an excel
I have a long running loop in an unfortunately large excel file that I'm
I have a fairly large Excel file. In this file there is a column
I have long HTTP request ( generating large Excel file - about 60K records
I have a large collection of data in an excel file (and csv files).
I have a text file that lists the names of a large number of
I have opened a large excel file as a Apache POI workbook (using VM
I have a large CSV data file -- ~1,444,000 rows of data -- that
I have an Excel file with a large set of VBA code. There are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.