Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • import excel file with space in name of file or folder

    I tried forward slashes and single and double quotes in all possible combinations, but I still can't get Stata (v 14) to import an excel file that resides in a folder with a space in the name - or a files that itself has a space in the name. Any suggestions?

    Thanks,

    Al Feiveson

  • #2
    Welcome to Statalist, Al.

    Not sure what your problem is - I can assure you it is possible.

    We can better help you if we know what commands you have tried and what Stata told you to indicate that there was a problem. Please review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. See especially sections 9-12 on how to best pose your question. It's particularly helpful to copy examples of your commands and their output (presumably error messages?) from your Stata Results window and paste them into your Statalist post using CODE delimiters. For example, the following:

    [code]
    . sysuse auto, clear
    (1978 Automobile Data)

    . describe make price

    storage display value
    variable name type format label variable label
    -----------------------------------------------------------------
    make str18 %-18s Make and Model
    price int %8.0gc Price
    [/code]

    will be presented in the post as the following:
    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . describe make price
    
                  storage   display    value
    variable name   type    format     label      variable label
    -----------------------------------------------------------------
    make            str18   %-18s                 Make and Model
    price           int     %8.0gc                Price

    Comment


    • #3
      Using Stata/IC 13.1 for Windows (64-bit x86-64):

      Code:
      . import excel "C:\Temp\Excel file with spaces in name.xlsx", sheet("Sheet1") firstrow
      
      . list
      
           +---------+
           | v1   v2 |
           |---------|
        1. |  1    2 |
        2. |  2    3 |
        3. |  3    4 |
           +---------+
      --
      Bruce Weaver
      Email: [email protected]
      Version: Stata/MP 18.5 (Windows)

      Comment


      • #4
        Aha! - the one thing I didn't try is to put the quotes at the very beginning of the path name! Thanks, Bruce!

        Al

        Comment


        • #5
          No worries, Al. You can always use the menu system to generate the code if you're getting stuck for too long. In this case, click on File > Import > Excel Spreadsheet to open the relevant dialog. Alternatively, type this command in the Command window:

          Code:
          db import excel
          Cheers,
          Bruce
          --
          Bruce Weaver
          Email: [email protected]
          Version: Stata/MP 18.5 (Windows)

          Comment

          Working...
          X