Parsing Excel spreadsheet to db

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Parsing Excel spreadsheet to db

    What would one best recommend to parse an existing Excel spreadsheet (was
    done in Excel 97 or 2000 not sure to be honest)? I am looking for the most
    practical way of parsing an existing spreadsheet to place contents into a
    mySQL db.

    Thanx, Phil

    PS: can you use fopen() to read the contents and parse? The spreadsheet is
    on a remote site.


    Phil Powell Guest

  2. Similar Questions and Discussions

    1. EXCEL spreadsheet
      Hello I'm new to InDesign, but love all the features it has to offer. I'm having a problem placing a EXCEL chart without the grid lines. In...
    2. Output to Excel spreadsheet
      Hi there Not sure whether anyone has done this. I have a user that specifically requires the output to be display and thus saved in an Excel...
    3. Spreadsheet-ParseExcel: Parsing various MS Excel file versions / grabing checkbox values?
      hi, after having some investigations i got stuck here. 1.) i need to parse excel files, which could be saved as MS Excel 95/97, 2000, XP or...
    4. Upload excel spreadsheet
      ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
    5. ASP and excel spreadsheet
      sure. just send it as CSV format - that way you'll get pretty much any platform out there. ________________________________________ Atrax....
  3. #2

    Default Re: Parsing Excel spreadsheet to db


    "Phil Powell" <soazine@erols.com> wrote in message
    news:aws7b.145605$xf.35957@lakeread04...
    > What would one best recommend to parse an existing Excel spreadsheet (was
    > done in Excel 97 or 2000 not sure to be honest)? I am looking for the
    most
    > practical way of parsing an existing spreadsheet to place contents into a
    > mySQL db.
    >
    > Thanx, Phil
    >
    > PS: can you use fopen() to read the contents and parse? The spreadsheet is
    > on a remote site.
    >
    >
    i don't know how big your spreadsheet is, but you could save the excel
    spreadsheet as a "csv" type file, then use fopencsv() to read it, then use
    explode() to create columns out of each row (thus giving you a
    multi-dimensional array breaking values down to an excel cell)... You could
    then use this array as your source data and send it to mysql.


    Randell D. Guest

  4. #3

    Default Re: Parsing Excel spreadsheet to db

    I would, but I have neither Microsoft Excel nor do I have the spreadsheet
    locally (were I to do so since not having Excel it would not be able to do
    anything with it.)

    Since I can't convert it to .csv because of that, what do I do?

    Thanx
    Phil

    "Randell D." <you.can.email.me.at.randelld@yahoo.com> wrote in message
    news:g7t7b.932607$3C2.21222945@news3.calgary.shaw. ca...
    >
    > "Phil Powell" <soazine@erols.com> wrote in message
    > news:aws7b.145605$xf.35957@lakeread04...
    > > What would one best recommend to parse an existing Excel spreadsheet
    (was
    > > done in Excel 97 or 2000 not sure to be honest)? I am looking for the
    > most
    > > practical way of parsing an existing spreadsheet to place contents into
    a
    > > mySQL db.
    > >
    > > Thanx, Phil
    > >
    > > PS: can you use fopen() to read the contents and parse? The spreadsheet
    is
    > > on a remote site.
    > >
    > >
    >
    > i don't know how big your spreadsheet is, but you could save the excel
    > spreadsheet as a "csv" type file, then use fopencsv() to read it, then use
    > explode() to create columns out of each row (thus giving you a
    > multi-dimensional array breaking values down to an excel cell)... You
    could
    > then use this array as your source data and send it to mysql.
    >
    >

    Phil Powell Guest

  5. #4

    Default Re: Parsing Excel spreadsheet to db


    "Phil Powell" <soazine@erols.com> wrote in message
    news:NIv7b.146397$xf.117696@lakeread04...
    > I would, but I have neither Microsoft Excel nor do I have the spreadsheet
    > locally (were I to do so since not having Excel it would not be able to do
    > anything with it.)
    >
    > Since I can't convert it to .csv because of that, what do I do?
    >
    > Thanx
    > Phil
    >
    > "Randell D." <you.can.email.me.at.randelld@yahoo.com> wrote in message
    > news:g7t7b.932607$3C2.21222945@news3.calgary.shaw. ca...
    > >
    > > "Phil Powell" <soazine@erols.com> wrote in message
    > > news:aws7b.145605$xf.35957@lakeread04...
    > > > What would one best recommend to parse an existing Excel spreadsheet
    > (was
    > > > done in Excel 97 or 2000 not sure to be honest)? I am looking for the
    > > most
    > > > practical way of parsing an existing spreadsheet to place contents
    into
    > a
    > > > mySQL db.
    > > >
    > > > Thanx, Phil
    > > >
    > > > PS: can you use fopen() to read the contents and parse? The
    spreadsheet
    > is
    > > > on a remote site.
    > > >
    > > >
    > >
    > > i don't know how big your spreadsheet is, but you could save the excel
    > > spreadsheet as a "csv" type file, then use fopencsv() to read it, then
    use
    > > explode() to create columns out of each row (thus giving you a
    > > multi-dimensional array breaking values down to an excel cell)... You
    > could
    > > then use this array as your source data and send it to mysql.
    > >
    > >
    >
    >

    If you don't have the Excel file locally, how do you expect PHP to process
    it? If you can get it via a hyperlink, then I make the assumption then that
    you have an "xls" type file - I don't believe there's an existing function
    that would open it for you.

    Is it a one off task? If so, and you don't know someone who has Excel to
    convert it for you, then try OpenOffice.org (free and works on all versions
    of office documents up to Office 2000). Then re-save it as a "csv" type
    file.
    --
    A: Because it messes up the order in which people normally read text.
    Q: Why is top-posting such a bad thing?
    A: Top-posting.
    Q: What is the most annoying thing on usenet?


    Randell D. Guest

  6. #5

    Default Re: Parsing Excel spreadsheet to db

    See Below

    "Randell D." <you.can.email.me.at.randelld@yahoo.com> wrote in message
    news:8py7b.933394$3C2.21274441@news3.calgary.shaw. ca...
    >
    > "Phil Powell" <soazine@erols.com> wrote in message
    > news:NIv7b.146397$xf.117696@lakeread04...
    > > I would, but I have neither Microsoft Excel nor do I have the
    spreadsheet
    > > locally (were I to do so since not having Excel it would not be able to
    do
    > > anything with it.)
    > >
    > > Since I can't convert it to .csv because of that, what do I do?
    > >
    > > Thanx
    > > Phil
    > >
    > > "Randell D." <you.can.email.me.at.randelld@yahoo.com> wrote in message
    > > news:g7t7b.932607$3C2.21222945@news3.calgary.shaw. ca...
    > > >
    > > > "Phil Powell" <soazine@erols.com> wrote in message
    > > > news:aws7b.145605$xf.35957@lakeread04...
    > > > > What would one best recommend to parse an existing Excel spreadsheet
    > > (was
    > > > > done in Excel 97 or 2000 not sure to be honest)? I am looking for
    the
    > > > most
    > > > > practical way of parsing an existing spreadsheet to place contents
    > into
    > > a
    > > > > mySQL db.
    > > > >
    > > > > Thanx, Phil
    > > > >
    > > > > PS: can you use fopen() to read the contents and parse? The
    > spreadsheet
    > > is
    > > > > on a remote site.
    > > > >
    > > > >
    > > >
    > > > i don't know how big your spreadsheet is, but you could save the excel
    > > > spreadsheet as a "csv" type file, then use fopencsv() to read it, then
    > use
    > > > explode() to create columns out of each row (thus giving you a
    > > > multi-dimensional array breaking values down to an excel cell)... You
    > > could
    > > > then use this array as your source data and send it to mysql.
    > > >
    > > >
    > >
    > >
    >
    >
    > If you don't have the Excel file locally, how do you expect PHP to process
    > it? If you can get it via a hyperlink, then I make the assumption then
    that
    > you have an "xls" type file - I don't believe there's an existing function
    > that would open it for you.
    >
    > Is it a one off task? If so, and you don't know someone who has Excel to
    > convert it for you, then try OpenOffice.org (free and works on all
    versions
    > of office documents up to Office 2000). Then re-save it as a "csv" type
    > file.
    > --
    I can't install OpenOffice! the setup.exe file does absolutely nothing. I
    went to [url]www.openoffice.org[/url] and downloaded the entire package for Windows
    2000, and nothing happens. So I'm back to the drawing board!

    Phil


    > A: Because it messes up the order in which people normally read text.
    > Q: Why is top-posting such a bad thing?
    > A: Top-posting.
    > Q: What is the most annoying thing on usenet?
    >
    >

    Phil Powell Guest

  7. #6

    Default Re: Parsing Excel spreadsheet to db

    Phil Powell wrote on Tuesday 09 September 2003 23:34:
    > I can't install OpenOffice! the setup.exe file does absolutely nothing. I
    > went to [url]www.openoffice.org[/url] and downloaded the entire package for Windows
    > 2000, and nothing happens. So I'm back to the drawing board!
    >
    There is one other way. If you have or have access to Excel ODBC drivers,
    you could set up an ODBC data source pointing to the specified Excel file
    with defined tables inside the spreadsheet. Then you could use the ODBC
    connection from PHP to access data from Excel spreadsheet like you would to
    other databases.

    One thing to keep in mind is that - Excel file has a proprietary format. If
    you do not have MS Office with Excel, you don't have COM components that
    access Excel spreadsheets, you don't have Excel ODBC drivers, and you
    cannot install any other applications that would export Excel spreadsheet
    to a non-proprietary format (like text CSV or tab-separated file), then you
    are running out of ways of accessing data stored in that file format.


    --
    Business Web Solutions
    ActiveLink, LLC
    [url]www.active-link.com/intranet/[/url]
    Zurab Davitiani Guest

  8. #7

    Default Re: Parsing Excel spreadsheet to db

    See below - thanx
    Phil

    "Zurab Davitiani" <agt@mindless.com> wrote in message
    news:%9B7b.2891$NS1.2574@newssvr25.news.prodigy.co m...
    > Phil Powell wrote on Tuesday 09 September 2003 23:34:
    >
    > > I can't install OpenOffice! the setup.exe file does absolutely nothing.
    I
    > > went to [url]www.openoffice.org[/url] and downloaded the entire package for Windows
    > > 2000, and nothing happens. So I'm back to the drawing board!
    > >
    >
    > There is one other way. If you have or have access to Excel ODBC drivers,
    > you could set up an ODBC data source pointing to the specified Excel file
    > with defined tables inside the spreadsheet. Then you could use the ODBC
    > connection from PHP to access data from Excel spreadsheet like you would
    to
    > other databases.
    >
    > One thing to keep in mind is that - Excel file has a proprietary format.
    If
    > you do not have MS Office with Excel, you don't have COM components that
    > access Excel spreadsheets, you don't have Excel ODBC drivers, and you
    > cannot install any other applications that would export Excel spreadsheet
    > to a non-proprietary format (like text CSV or tab-separated file), then
    you
    > are running out of ways of accessing data stored in that file format.
    >
    >
    Exactly. I don't have Office so I wouldn't have the Excel ODBC drivers. I
    wound up sending the file to a colleague who converted it for me into CSV.
    Hopefully a one-time solution, other than that, I am powerless to do
    anything else.

    Phil

    > --
    > Business Web Solutions
    > ActiveLink, LLC
    > [url]www.active-link.com/intranet/[/url]

    Phil Powell Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139