Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you select a specific sheet and extract all sheets names from excel file #380

Open
DktPhl2019 opened this issue Oct 12, 2024 · 1 comment

Comments

@DktPhl2019
Copy link

Hello

  1. After I open excel file, I need to select a specific sheet.

The code says: var sheet1 = excel['Sheet1'];

I have sheets: x1, Phila, oldTown, and myTest

How do I select a specific sheet?

sheet1 is a default sheet.

I need to select sheet: myTest

How do I do that?
 
2. I need to extract all sheet names from excel file.

The api docs say: var p = excel['p']; where p is a sheet name.

The api docs also say: p.SheetName.

I am not sure how to get a sheet name when I don't specify a sheet name.

I need to do something like this - please see the code below.

Thank You,

var myfile = 'C:/test/mytest.xlsx';
    var bytes = File(myfile).readAsBytesSync();
    var excel = Excel.decodeBytes(bytes);
    int p = excel.sheets.length;
    var sheet1 = excel['Sheet1'];

    for (int i = 0; i<=p;i++){
      sheet1.cell(CellIndex.indexByString('A'+i.toString())).value = TextCellValue(excel[i.sheetName]);
    }
@DktPhl2019
Copy link
Author

Hello! Could you please reply. There is no response for one month. Thank You

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant