Jump to content

Search the Community

Showing results for tags 'getexcel'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions

Categories

  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 1 result

  1. Hi Everyone, I'm new to AutoCAD lisp and have a couple of questions regarding GetExcel from the GetExcel.lsp functions. I am generating several tables using data from an excel spreadsheet. The spreadsheet contains several "Sheets" and a new table will be generated from each sheet. It will be unknown how many "Sheets" the excel spreadsheet will have. I do not see any easy way to find out how many sheets are in the spreadsheet so I wrote a function that will call GetExcel and compare cell "A1" with a known value. This value should be in cell "A1" for all used sheets. My problem is that if a blank sheet is not added as the last sheet my function will fail. I do not know a lot about the GetExcel code but it appears that if a particular sheet is requested and is not in the spreadsheet the function returns the sheet that corresponds to the looped sheet number. For example if a spreadsheet has 3 sheets and you request "Sheet4" it returns the data from "Sheet1". The idea was for the LISP routine to call GetExcel with successive "Sheet" numbers, test "A1" for a particular value, if the value was expected then save the *exceldata@ array to a new variable to get the next sheet. I was also under the impression that the "GetExcel" function opened the excel file, grabbed the data and closed it. When GetExcel is called multiple times a popup is presented prompting the user to "Close all excel spreadsheets to continue". When "OK" is pressed the function works as expected. I'm probably not using the GetExcel code as it was intended but maybe someone can help me out. I have posted some code that I was initially testing with to get the number of sheets in the spreadsheet. TIA (defun GetSheetCount ( excelfile / count continue ) (setq count 1) (setq continue 1) (while (= continue 1) (progn (getexcel excelfile (strcat "Sheet" (rtos count 2 0)) "A1") (if (= (car (car *exceldata@)) "Section Title") (progn (setq count (1+ count)) ) (setq continue (1- continue)) ) ) ) (1- count) )
×
×
  • Create New...