LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-31-2017, 08:41 AM   #1
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Rep: Reputation: Disabled
Script to freeze top row on all .xlsx files


Is it possible through a script to freeze the top row on all .xlsx files in a folder?
 
Old 01-31-2017, 08:51 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,691

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
What do you mean by freeze?
 
Old 01-31-2017, 08:54 AM   #3
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
Like when I scroll down an excel file, the very top row that has the headers is still visible
 
Old 01-31-2017, 09:01 AM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
They're called columns, for starters.

Press F1 and search for column
"Freezing Rows or Columns as Headers".

via script? If you have to ask, it won't be easy for you.</opinion>
Done.

Last edited by Habitual; 01-31-2017 at 09:02 AM.
 
Old 01-31-2017, 09:11 AM   #5
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
@Habitual......well maybe I should have said 'column headers'. Hmmm. It's not easy for me, which is why I'm asking. Lol. I know how to freeze the top row in Excel, but I wanted to see if this is possible in a script in Linux.

Last edited by trickydba; 01-31-2017 at 09:19 AM.
 
Old 01-31-2017, 09:27 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,691

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
It can be done using a visual basic script from within Excel. Been awhile since I've really used VB. You should be able to expand the link below to open worksheets, freeze the 1st row, save and close it.

http://stackoverflow.com/questions/3...t-in-excel-200
 
Old 01-31-2017, 09:32 AM   #7
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
Yea I researched that page already. Was hoping that I can do this all in linux.
 
Old 01-31-2017, 10:04 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,691

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
Not as far as I know...
 
Old 01-31-2017, 10:25 AM   #9
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
Ok. Yea I researched alot and I couldn't find anything. Appreciate all the help as usual!
 
Old 02-01-2017, 12:55 AM   #10
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
Umm, trickydba this thread is NOT solved. Other people searching for a solution will not find it here. Please remove the "solved" label.
 
Old 02-01-2017, 04:00 AM   #11
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,303
Blog Entries: 3

Rep: Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720Reputation: 3720
Quote:
Originally Posted by trickydba View Post
Ok. Yea I researched alot and I couldn't find anything. Appreciate all the help as usual!
Then it's not solved yet and could be unmarked to avoid luring people here in expectation of a solution.

If you are still looking, you could check to see about LibreOffice macros. LibreOffice can be launched headless and macros can be written in python, javascript, or java. If it is possible to launch macros from a separate file, then that might be the way to go.
 
Old 02-02-2017, 02:10 AM   #12
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Posts: 952

Rep: Reputation: 217Reputation: 217Reputation: 217
Earlier versions of excel had a specific xl file in a startup under your login's settings) where the default excel.xls was available.

You changed windows --> Freezepanes, saved it under some other name, quit excel, renamed the template file and reloaded excel to see the desired default.

OK
 
Old 02-02-2017, 04:20 AM   #13
ecos
LQ Newbie
 
Registered: Oct 2011
Posts: 1

Rep: Reputation: Disabled
Script to freeze top row on all .xlsx files

There are several ways to modify .xlsx files in Linux.
First you have to select a framework to edit each file with. Then you loop through all the files and process them as described below.

You could use the Java-based Framework Apache POI and process the files as described in https://stackoverflow.com/questions/...ng-header-rows.

Or, since .xlsx files are in effect ZIP archives containing mostly XML files, you could do this small change directly. According to a short comparison:
in file xl/worksheets/sheet1.xml (and other worksheet files if present)
... two child elements were inserted below /worksheet/sheetViews[1]/sheetView[1]:
Quote:
<pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/>
<selection pane="bottomLeft"/>
  • Unzip the .xlsx file in a working directory
  • Change the file(s) using the XML tool of your choice
  • zip the file again
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LibreOffice .xlsx files are huge terry-duell Linux - Software 4 11-08-2012 11:12 PM
Converting xlsx files to text Sanford Stein Linux - Software 8 07-11-2012 10:22 AM
looking for software to open .xlsx files with linux tjcarol Linux - Software 3 09-28-2011 05:37 AM
making a row always on top in an openoffice spreadsheet (oocalc) zymos Linux - Software 2 03-25-2008 10:09 PM
Shell script to parse csv-like output, row by row utahnix Linux - General 8 12-08-2007 05:03 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration