Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Iteration over columns in Excel
Iteration over columns in Excel [message #1836003] Fri, 18 December 2020 05:50 Go to next message
Dmitry Kashel is currently offline Dmitry KashelFriend
Messages: 4
Registered: December 2020
Junior Member
Please suggest how I can iterate over all columns of Excel spreadsheet using EOL language?
Re: Iteration over columns in Excel [message #1836006 is a reply to message #1836003] Fri, 18 December 2020 06:42 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi Dmitry,

A small example that iterates over all the worksheets, columns and rows of a spreadsheet without referring to them by name follows (M is the name of the spreadsheet in the run configuration of the EOL program).

// Iterate over all worksheets
for (w in M.worksheets) {
  w.name.println();

  // Iterate over all columns
  // of the worksheet
  for (c in w.header.columns) {
    c.name.println("\t");
  }

  // Iterate over all rows
  // of the worksheet
  for (r in w.rows) {
    r.println("\t");
  }
}


Additional methods of interest for this mode of access can be found in the Javadoc of the underlying ExcelModel [1] and SpreadsheetModel [2] classes.

Thanks,
Dimitris

[1] https://download.eclipse.org/epsilon/interim-javadoc/org/eclipse/epsilon/emc/spreadsheets/excel/ExcelModel.html
[2] https://download.eclipse.org/epsilon/interim-javadoc/org/eclipse/epsilon/emc/spreadsheets/SpreadsheetModel.html
Re: Iteration over columns in Excel [message #1836098 is a reply to message #1836006] Mon, 21 December 2020 04:02 Go to previous messageGo to next message
Dmitry Kashel is currently offline Dmitry KashelFriend
Messages: 4
Registered: December 2020
Junior Member
Thank you, Dimitris for the answer.
I have another question.
How I can use Apache POI in Epsilon. For example I need merge cells, there have addMergedRegion method. Can I call it, or have another approach to do it.
Thank you for support.
Re: Iteration over columns in Excel [message #1836108 is a reply to message #1836098] Mon, 21 December 2020 12:52 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi Dmitry,

I'm not familiar with the particular method but in general, you can call any method provided by Java objects in EOL.

Thanks,
Dimitris
Re: Iteration over columns in Excel [message #1855853 is a reply to message #1836108] Mon, 07 November 2022 20:00 Go to previous messageGo to next message
Adekunle Adeyemo is currently offline Adekunle AdeyemoFriend
Messages: 1
Registered: November 2022
Junior Member
Hello Dmitry, Please I would love to know more about, calling a Java Method in EGL.
Re: Iteration over columns in Excel [message #1855858 is a reply to message #1855853] Mon, 07 November 2022 23:44 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi Adekunle,

As EGL is an extension of EOL, the discussion in this article also applies to EGL. Please let us know if you have any further questions.

Thanks,
Dimitris
Previous Topic:Possible Major Bug: CachedResourceSet holds state over boundary of Ant run.
Next Topic:EGX Parallel Execution
Goto Forum:
  


Current Time: Sat Apr 27 07:56:57 GMT 2024

Powered by FUDForum. Page generated in 0.03244 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top