Git Product home page Git Product logo

Comments (3)

dfinke avatar dfinke commented on May 27, 2024

@merill Thanks for trying ImportExcel and the request. That can be done in a couple ways. Let me know how it goes. I'll add this to the examples folder.

$data = ConvertFrom-Csv @"
Region,State,Units,Price
West,Texas,927,923.71
North,Tennessee,466,770.67
East,Florida,520,458.68
East,Maine,828,661.24
West,Virginia,465,053.58
North,Missouri,436,235.67
South,Kansas,214,992.47
North,North Dakota,789,640.72
South,Delaware,712,508.55
"@

$xlfile = "$PSScriptRoot\spike.xlsx"
Remove-Item $xlfile -ErrorAction SilentlyContinue

function UseActivate {
    $data | Export-Excel -Path $xlfile -WorksheetName Tab1
    $data | Export-Excel -Path $xlfile -WorksheetName Tab2 -Activate
    $data | Export-Excel -Path $xlfile -WorksheetName Tab3 -Show
}

function UseSelectWorksheet {
    $data | Export-Excel -Path $xlfile -WorksheetName Tab1
    $data | Export-Excel -Path $xlfile -WorksheetName Tab2 
    $data | Export-Excel -Path $xlfile -WorksheetName Tab3

    $xlpkg = Open-ExcelPackage $xlfile

    Select-Worksheet -ExcelPackage $xlpkg -WorksheetName Tab3
    Close-ExcelPackage $xlpkg -Show
}

UseSelectWorksheet

from importexcel.

merill avatar merill commented on May 27, 2024

Amazing. That worked perfectly @dfinke thanks a lot.

Interestingly, I was trying to figure it out yesterday and copilot was totally hallucinating. It did get very close with Set-ActiveSheet instead of Select-Worksheet. Even the parameter names were correct.

CleanShot 2024-02-04 at 12 46 41@2x

from importexcel.

dfinke avatar dfinke commented on May 27, 2024

Cool. When copilot first came out I was promoting it about PowerShell and Excel. Didn’t know about my module. Took a few months is additional training. Then it knew some things and started hallucinating function names. I was like hmm, those are better ones than I came up with.

from importexcel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.