Powershell - Excel: Find named cells and their values

Pagina: 1
Acties:
  • 821 views

  • mootjuhh
  • Registratie: April 2013
  • Laatst online: 01-09-2024
Hi,

Currently, I'm working on a PowerShell script which will read data from excel files. reading the cell values is not a problem as long as I use numbered reference (eg. instead o1,1 instead of A1). However, it is easy to add or remove rows/columns and therefore a fixed cell is not desirable.

We decided to used named cells, to fix the problem of adding rows/column. A new problem is the PowerShell script. I can't find an example of reading named cell.

Does anyone kwon whet

her it is possible to use named cell references?

Part of my current code:

$book=$excel.Workbooks.Open($global:filesNames[1].FullName)
$sheet=$book.WorkSheets.item(1)
$Cell=$sheet.Cells.Item(2,1).text #(row,col)
$Cell

What I would like:

$book=$excel.Workbooks.Open($global:filesNames[1].FullName)
$sheet=$book.WorkSheets.item(1)
$Cell=$sheet.Cells.Item("First_Name").text #(named cell)
$Cell

Many thanks in advance

P.s. Vraag staat ook op het Microsoft forum, maar tot op heden nog geen reactie op gehad. Hopelijk hier meer geluk.

  • ArnoutV
  • Registratie: December 2005
  • Laatst online: 16:52
Waarom in het Engels??

Maar gaat dat niet via de Range object?

Acties:
  • 0 Henk 'm!

  • mootjuhh
  • Registratie: April 2013
  • Laatst online: 01-09-2024
Thanks. De " was wat eerst niet werkte.

Acties:
  • 0 Henk 'm!

  • Creepy
  • Registratie: Juni 2001
  • Laatst online: 10:03

Creepy

Tactical Espionage Splatterer

Open je dan je volgende topic gewoon in het Nederlands? Want anders gaat ie gewoon op slot ;) We zijn hier nog steeds een Nederlands forum, geen Engelse..

[ Voor 14% gewijzigd door Creepy op 19-02-2017 19:28 ]

"I had a problem, I solved it with regular expressions. Now I have two problems". That's shows a lack of appreciation for regular expressions: "I know have _star_ problems" --Kevlin Henney


Acties:
  • 0 Henk 'm!

Verwijderd

There are only two hard things in computer science: Naming things and vertically centering things - @DavidKPiano
We're building self-driving cars, but we haven't even figured out how to make sure vacuum cleaners don't join botnets. ?????????????????? Nederlands ????????????

Acties:
  • 0 Henk 'm!

  • RobIII
  • Registratie: December 2001
  • Niet online

RobIII

Admin Devschuur®

^ Romeinse Ⅲ ja!

(overleden)
d:)b thanks voor deze nuttige bijdrage! _O_

Overigens: het is "There are 2 hard problems in computer science: cache invalidation, naming things, and off-by-1 errors. -- Leon Bambrick" :+

[ Voor 63% gewijzigd door RobIII op 28-11-2018 13:57 ]

There are only two hard problems in distributed systems: 2. Exactly-once delivery 1. Guaranteed order of messages 2. Exactly-once delivery.

Je eigen tweaker.me redirect

Over mij

Pagina: 1

Dit topic is gesloten.