• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

javascript .xls import range = a1: "end of table" ?

Community Beginner ,
Nov 02, 2016 Nov 02, 2016

Copy link to clipboard

Copied

Dear Indesign-script developers!


i'm scripting the import of xls tables that are placed in the indd. within the excelimportpreferences i can define the range of cells to import by "range = a1:b4" (importing row a column1 to row b column4)

simple question: is there a way to get the last row and last column of the xls table? with last i mean the last cell thats not empty.
depending on that information i'd be able to decide if a set range fills my page, or if my range is at the end of the xls table (if the range is beyond the rows/columns end it results in an error and the script simply aborts.)  "try and catch" to import each single row seperately will take too long for real life xls tables, which have up to 10.000 rows...

TOPICS
Scripting

Views

360

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 02, 2016 Nov 02, 2016

Copy link to clipboard

Copied

[moved to InDesign Scripting]

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Nov 02, 2016 Nov 02, 2016

Copy link to clipboard

Copied

LATEST

Hi,

If you would not specify 'range' property - InDesign will import entire 'filled with data' table (to the last not empty col & row)

If your goal is to know this range before import - you will need to open a Worksheet and exam it using Visual Basic snippet.

It can be done running javascript doScript() method since you would build VB code as a String.

See this post for a details:

load excel spreadsheet to table variable?

Jarek

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines